Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert (Append) query only adding first field

Status
Not open for further replies.

FabricMan

Technical User
Dec 29, 2009
7
US
I'm trying to write procedures in my desktop app to import data from a flat text file (upwards of 800,000 rows) and append it to a table. I am doing this by creating a linked table with the exact same field structure and running an append query. I'm doing all of this in VBA.

The procedure is supposed to get the file name from the user, link the table, append the records, then delete the link. The problem is the query. Often it doesn't run, throwing error 3001: invalid arguments, even though the query itself has no parameters. When it does run, it only adds the first field: ssn. I wind up with a table full of Social Security numbers and null fields.

Code:
INSERT INTO tblBenefits
(ssn, clm_id, cca_id, cct_id, bye, wk_ending, cct_post, reg, cwc,
seasonal, school, ucfe, ucx, interliab, interagent, cct_pd_amt,
cct_irs_am, cct_csiamt, cct_offset, cell38, cell39, cell40, cell41,
cell42, cell43, cell45, cell46, cell47, cell48, cell49, cell50,
cell51, cell52, cell53, cell54, cell55, cell56, cell57, cell58)
(SELECT ssn, clm_id, cca_id, cct_id, bye, wk_ending, cct_post, reg,
cwc, seasonal, school, ucfe, ucx, interliab, interagent,
cct_pd_amt, cct_irs_am, cct_csiamt, cct_offset, cell38, cell39,
cell40, cell41, cell42, cell43, cell45, cell46, cell47, cell48,
cell49, cell50, cell51, cell52, cell53, cell54, cell55, cell56,
cell57, cell58
FROM tblBenLink);

111-11-1111 null null null...
111-11-1112 null null null...
...

The text file is linking correctly. I can't figure out where the rest of my data is going.
 
The SELECT ... FROM tblBenLink clause should NOT be enclosed with parenthesis.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Solved. It was a VBA problem, not a query problem.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top