sql update from runtime

J

Jamal

I have the below script to update a table;

Dim db3 As DAO.Database
Dim rst3 As DAO.Recordset
Set db3 = Access.Application.CurrentDb
Dim sql3 As String
sql3 = "update [DTII & DTM Hardware assests] set [Machine Name] = '" &
CompName & _
"', [Dealer #] = '" & dlrnm & _
"', [Unit ID] = '" & ui & _
"', [dtiiversion] = '" & dtiiv & _
"' where [unitid] = '" & ui & "'"
db3.Execute sql3
db3.Close
Set rst3 = Nothing
Set db3 = Nothing


For some reason update sql command is not working.
I see the values are there because I add watch to each variable.
please help.
 
A

Albert D. Kallal

Add the follwing line of code:
db3.Execute sql3

debug.Print sql3 <--- add this line right after above...

Now, run the code. After, hit ctrl-g to get to the debug window, and now
cut+paste the sql string in the debug window into the query builder....

Try running your sql in the query builder...does it work????
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top