The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

INSERT INTO syntax, wildcard

Couldn't find an answer by doing a search, so I'll ask my question:

I want to take data from an Access query (NewFolks) and put it into a table (New_tbl). The query (NewFolks) pulls from an externally linked, tab delimited .txt file that is updated by uploading a new .txt file into the folder. The problem arise when someone doesn't have a value for "address2" in their information - I get the following error "The Microsoft Jet database engine does not recognize '[address2]' as a valid field name or expression."

Here is what I have used as an SQL statement:

INSERT INTO New_tbl (id,lastname,firstname,address1,address2)

SELECT id,lastname, firstname, address1, address2 FROM NewFolks

Is there a way to use a wildcard to only select and insert the data that is available?

I wish I could!

Unfortunately, I do not have control over the .txt files (there are two, and I combine them in an Access query). I simplified it for the the example - my actual SQL statement has about 30 fields it is working with, and 21 of those may or may not be used, and I have no control over them. I have to make it work no matter which fields the .txt files contains.