piersonpro said:
Thank you for your response. however, I need to make a table that will be
saved in another database for my label program. The label program polls for
this table. When it finds the table it prints all records (labels). Once my
label program makes the labels (one per record), the program deletes the
table. This is why I need a record for each invoice items quantity.
I wanted to write it in vba so I can have a button on the invoice form
marked 'make labels'. This would make a table as described above.
Sounds a little clumsy to me, but it's not my program.
Regardless, you can use the above query in a make table
query and run it from your code. The make table query can
even make the table in the other database without first
making the table in your database.
Assuming my query above is named qryinvoicelines (and that
you modify it to select a specific invoice), the code to
make the table in your database would be like:
strSQL = "SELECT Num, itemdescr, quantity " _
& "INTO newtable " _
& "FROM qryinvoicelines"
CurrrentDb. Execute strSQL, dbFailOnError
To make the table in the other database:
strSQL = "SELECT Num, itemdescr, quantity " _
& "INTO newtable IN ""path to other db"" " _
& "FROM qryinvoicelines"
CurrrentDb. Execute strSQL, dbFailOnError