[thelist] updating a record?

Jeremy Weiss jweiss03 at comcast.net
Sat Oct 12 18:38:00 CDT 2002

I've got a field in one of my tables that I want to serve as a counter.  I'm
trying to increment it each time the corresponding record is accessed.
Here's the code snip that's doing the update.

	Dim SearchStr
	Dim RS
	Dim cmacount

	SearchStr = "SELECT cmacount FROM zip_tbl WHERE zipcode Like '%" &
Replace(zipcode, "'", "''") & "%' "

	DBPath = Server.MapPath("../../Database/agentszips2.mdb")
	Set RS = Server.CreateObject("ADODB.Connection")
	RS.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & DBPath & ";",
adOpenKeyset, adLockPessimistic, adCmdText

	Set RS = conn.execute(SearchStr)

	ccount = RS.Fields("cmacount").Value
	RS.Fields("cmacount").Value = ccount + 1

	Set RS = Nothing

Now, whenever I run this, I'm told that the
	"Current Recordset does not support updating. This may be a limitation of
the provider, or of the selected locktype."
The line number is gives the one that says...
	RS.Fields("cmacount").Value = ccount + 1

Anyone have any ideas?


More information about the thelist mailing list