Append query issue - 3067 runtime error

downhilljon

Registered User.
Local time
Tomorrow, 04:47
Joined
Jun 14, 2007
Messages
31
Hi there,

I'm hoping someone can help me solve this one.

My append code pops up with a runtime error (3067) when it gets to the DoCmd.RunSQL line. Here is the code:

Code:
   strSQL1 = "INSERT INTO [tblCustomers] ( FirstName, Surname, Address, Suburb, State, PostCode, WorkPhone, MobilePhone )" & _
              "SELECT '" & strFirstName & "' AS FirstName, '" & strSurname & "' AS Surname, '" & _
              strAddress & "' AS Address, '" & strSuburb & "' AS Suburb, '" & _
              strState & "' AS State, '" & strPostCode & "' AS PostCode, '" & _
              strWorkPhone & "' AS WorkPhone, '" & strMobilePhone & "' AS Mobile Phone;"

DoCmd.RunSQL strSQL1

I copied, pasted and modified from an existing append SQL statement, so I'm fairly certain the structure is correct, probably just missing something small and silly!

I have also tried creating the append query and copying and pasting in the resulting SQL statement Access generates, and that gave me a different problem, so I'll just concentrate on this for now.

Any help is appreciated!

Cheers
 
it is not this "AS Mobile Phone;" which should be "AS MobilePhone;" ? Is it?
 
Jon, the first thing I noticed when I looked at your query was that you have no source. Are you selecting this data from anywhere or are you just pulling it out of the air? ;)
Query input must contain at least one table or query. (Error 3067)

In Microsoft Access database engine databases, this error occurs if you do not select a table name when you create a query. Select at least one table or query.

In ODBCDirect databases, this error occurs if you attempt to execute a query that does not contain an SQL statement. Include at least one query or stored procedure call in the QueryDef object's SQL property.

© 2006 Microsoft Corporation. All rights reserved.
 
Yep, that was it. Thanks for picking up what my tired eyes missed!!!!
 
Thanks for picking that up Adam. The source is assigned earlier on in the code to my variables (strFirstName, strSurname, etc) which pull info from unbound textboxes on a form.

Thanks for the reply though, the main thing is it works!
 

Users who are viewing this thread

Back
Top Bottom