troubleshooting Question

Creating a Temp Table in MS Access

Avatar of TechNinja2
TechNinja2 asked on
Microsoft AccessVBA
5 Comments1 Solution1891 ViewsLast Modified:
Amazing Experts!

I'm stuck.  I combined a bunch of tables into a union query and am trying to dump that query back into a table so I can add a checkbox field and make the query "editable" so to speak.  The problem is that the query has 5000+ records, but when I run the code, I only end up with 200+ records in the blank table.  I'm not getting an error message and I back checked that my blank table has the correct amount of fields.  (Note: I can't upload the database since it is client confidential, but I can generalize the content.)

I used this vba/SQL code in the OnLoad event of the form:
CurrentDb.Execute "INSERT INTO TBL_Blank  (Field1, Field2, Field3 ...)
SELECT Field1, Field2, Field3 ... FROM QRY_CombinedRecords;", dbFailOnError

Should I be using DAO.Database (see mwolfe02 response)?
http://stackoverflow.com/questions/6843017/how-to-insert-entire-dao-recordset-into-a-table-with-vba

or recordset (see Gord Thompson response).


I'm not sure why it doesn't just copy the 5,000+ records in the query and pastes them in the blank table I set up.

Any ideas?
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros