Hi Guys,
Having problems trying to run a SQL Script in VB. The SQL works fine in a query but in VB I get "Syntax error" (you can write what I know about VB on the back of a box of matches ). I want the code to run as a function so I can call it from a macro rather than a query so have tried the following:-
Function DoSQL()
Dim SQL As String
SQL = "INSERT INTO AssetDB (FAR_AssetCode)" & _
"SELECT NewAssetData.FAR_AssetCode" & _
"FROM NewAssetData" & _
"WHERE NewAssetData.FAR_AssetCode > (Select Max(FAR_AssetCode) from AssetDB);"
DoCmd.RunSQL SQL
End Function
Any help appreciated
Dave
Social Networking Bookmarks