Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Convert asp syntax to access query?

Status
Not open for further replies.

DebbieDavis

Programmer
Jun 7, 2002
146
US
Hello all, I wrote the following code for an Active Server Page but I really need to use it in Access. Could someone please help me convert it and maybe help me know how to use it in Access? Please forgive my ignorance. I don't get to use Access too much. Many thanks!

Code:
	'Create a recordset object
	Set oRs = Server.CreateObject("ADODB.RecordSet")

	 	 ' Open the table
	oRs.Open "customers", objConn, adOpenKeySet, adLockPessimistic, adCmdTable
	if not oRs.eof then
	do while not oRs.EOF
	oRs.Update
on error resume next
		For Each fld in oRS.Fields
			'If a value for the column name was passed in,
			'set the column name equal to the value passed through the form...
			if fld.value>0 then
				fld.Value = trim(fld.value)
			end if
		Next
		oRs.MoveNext
		loop
else
Response.Write "This record did not get updated."
end if
 
Debbie:

As long as you have a reference to the ADO object library, you should be able to use the exact code (without the server. references ... you can just use CreateObject) with a couple little mods.

Out of curiosity ... without seeing the whole module, what exactly are you trying to do with the snippet you posted? It looks like you're just trimming extraneous spaces off each piece of data in the customers table ...

HTH

Greg Tammi, IT Design & Consultation
Work: Home:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top