sql update from runtime

  • Thread starter Thread starter Jamal
  • Start date Start date
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.
 
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????
 
Back
Top