Hi to all!
I've written the following SQL statement to save the values from an array into a table.
When I run the program I get syntax error.
I've tried using brackets for Values, but then it gave me some other error message like invalid use of '.', '!', '()' in query statement.
I've spent hours on it trying several possibilities but I simply can't figure out what's wrong.
DoCmd.RunSQL "INSERT INTO TempTable (CId,CName,CRoom,Amount) VALUES Clients(Element).CustomerID, Clients(Element).ClientSurname, Clients(Element).RoomNo, Clients(Element).Amount"
I also tried this:
DoCmd.RunSQL "INSERT INTO TempTable (CId,CName,CRoom,Amount) VALUES(" & Clients(Element).CustomerID & ",""" & Clients(Element).ClientSurname & """,""" & Clients(Element).RoomNo & """,""" & Clients(Element).Amount & """)"""
Using Access 03 VBA. Wrote the whole statement in one single line.
I've written the following SQL statement to save the values from an array into a table.
When I run the program I get syntax error.
I've tried using brackets for Values, but then it gave me some other error message like invalid use of '.', '!', '()' in query statement.
I've spent hours on it trying several possibilities but I simply can't figure out what's wrong.
DoCmd.RunSQL "INSERT INTO TempTable (CId,CName,CRoom,Amount) VALUES Clients(Element).CustomerID, Clients(Element).ClientSurname, Clients(Element).RoomNo, Clients(Element).Amount"
I also tried this:
DoCmd.RunSQL "INSERT INTO TempTable (CId,CName,CRoom,Amount) VALUES(" & Clients(Element).CustomerID & ",""" & Clients(Element).ClientSurname & """,""" & Clients(Element).RoomNo & """,""" & Clients(Element).Amount & """)"""
Using Access 03 VBA. Wrote the whole statement in one single line.