I recommend you set up your
VB code something like this:
SQL = the sql statement
Debug.Print SQL
DoCmd.RunSQL SQL
The Immediate Window will have the exact SQL statement that is executed. If you can copy the SQL from the Immediate Window into a query and run that successfully, there is something really, really wrong. My bet is that the sql statement that you think you're running in
VB isn't the same as the one you tested in a query.
Primarily, your problem is likely to be that the sql statement has quotes in it and in
VB you'll have to double-up or triple-up the quotes to get the correct SQL syntax.
Randall J Weers
Membership Vice President
Pacific NorthWest Access Developers Group
http://www.pnwadg.org