Query in VBA Syntax!

voskouee

Registered User.
Local time
Yesterday, 20:41
Joined
Jan 23, 2007
Messages
96
Is there a site that will indicate how do i syntax queries in VBA.

i cant figure the syntax out. I have searched this site and google and i cant find a unique way to write my queries in vba..

for example.. i get an synatax error on this..

Sub Update_SOBP()

Dim rs As DAO.Recordset
Dim strSQL As String

Set rs = CurrentDb.OpenRecordset("SELECT SOBP FROM Countries;")
Do While Not rs.EOF

'debit for normal case
DoCmd.SetWarnings (False)
strSQL = "UPDATE" & rs!SOBP & " [Query1.sobp] SET (SOBP) ='" & rs!SOBP & "';"
DoCmd.RunSQL (strSQL)
DoCmd.SetWarnings (True)


rs.MoveNext

Loop
End Sub



If someone can direct me to a site where i can find all the action queries and their syntax i would appreciate it.

thanks a lot.

I have to do many of them and i am practising also.

the idea is that i have a table and based on a value of table i update another another value on another table...
 
strSQL = "UPDATE" & rs!SOBP & " [Query1.sobp] SET (SOBP) ='" & rs!SOBP & "';"
you do not have a space after UPDATE
 

Users who are viewing this thread

Back
Top Bottom