SQL or VB?

shacket

Registered User.
Local time
Today, 10:26
Joined
Dec 19, 2000
Messages
218
I want to change the field in all records with certain criteria through code. I have tried DoCmd.RunSQL but I am having some difficulty with the SQL statement. (I have made it with the query builder, but I'll spare you the details for now about what is difficult)

I know how to do it with VB, i.e.:

rs.MoveFirst
Do Until rs.EOF
If rs![Field] = Criteria Then rs![Field2] = Update
rs.MoveNext
Loop

Is there a reason (speed, efficiency, etc.) that I would want to struggle with the SQL code in lieu of doing it with the above VB code?

Thanks.

Dave
 
OK Pat,

maybe you can help me, then. My problem with the updatequery is that the updates are based on information that can only be found in another query (MAX of [field]). When I put the SQL together (from the query builder) it won't let the update query execute because it says that it is not an updateable query (the query with the MAX field) even though I am asking it to update a table linked to that query.

(I hope that makes sense) How would I get around that?

Dave
 

Users who are viewing this thread

Back
Top Bottom