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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

access 97 update query

Status
Not open for further replies.

Faroon

Programmer
Jun 16, 2003
46
CA
Hi all,

In access 2000 I can update my records using this:

set con = CurrentProject.Connection
set rs = con.Execute("UPDATE
SET [col1] = " & val1")

How can I do the same in access 97? Thanks.
 
Running UPDATE queries doesn't require recordset variables in any case, but here goes:

DoCmd.RunSQL "UPDATE etc"


You could also add an ADO reference to your Access 97 database (CTRL-G, Tools->References) and your above code would probably work with some modifications.
 
Thanks, it worked. Why is it so different between 97 and 2000? Can I use DoCmd.RunSQL for all other queries such as select, insert, delete.. too?
 
I have little direct experience with 2000, but the general gist is that 2000 onwards are de-emphasizing using DAO for data manipulation in favor of ADO-based access. This, in turn, allows for a smoother introduction into the world of server databases and such.

What I'm saying is that Access 97 will by default assume you are connecting to an Access 97 MDB backend, whereas 2000+ assumes that you are not. Case in point: ADO is not referenced at all by default in 97, but in 2000 it receives priority over the similar DAO library.


I believe DoCmd.RunSQL is still in 2000+, so you can use it for a lot of things. There are reasons not to use it, such as lack of error handling, but it works.

SELECT queries DO return a recordset, so use your above method to grab the recordset.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top