Append query with functions

latex88

Registered User.
Local time
Today, 04:50
Joined
Jul 10, 2003
Messages
198
Is Access just being pissy? I thought I've made numerous queries like this, but now it's giving me the error message of "Query input must contain at least one table or query." What is wrong with it?

I am basically trying to append data from text boxes of a form to a table. I have stored all the values of the text boxes into global variables, then I call them in an append query. I know these functions return the values correctly. In the query, I don't have any tables in it. I just have functions. Please see attached. The SQL is below.

INSERT INTO tblDeliveryAddresses ( ADDRESS, City, Zip, Telephone )
SELECT NewAddressFunc() AS Address, NewCityFunc() AS City, NewZipFunc() AS Zip, TeleNumFunc() AS Telephone
WHERE (((NewAddressFunc()) Is Not Null));
 

Attachments

  • AddressAppendQuery.jpg
    AddressAppendQuery.jpg
    65.4 KB · Views: 120
Did you try with Values instead of Select?
 
The error was caused by the criteria of "Is not null". When I removed it, the query worked fine, but it would append blank data. That is what I'm trying to prevent. Maybe I'm not resetting the variable correctly. After certain events, I set all the variables that feed the said functions to "". For example,

txtVariable1 = ""
txtVariable2 = ""
 

Users who are viewing this thread

Back
Top Bottom