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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

create table from listbox 1

Status
Not open for further replies.

danomaniac

Programmer
Jan 16, 2002
266
US
I'm building a form in Access 2K - there is a multiselect listbox that users will pick items from then click 'print' and a report for each item will print. That's done. I also want to populate a temporary table with each item selected to use in a query for a report. Basically a hard copy list of reports ran. I have an invisible listbox that I populate with just the selected items each time the button is pressed, but how do I get that to a table?

Thanks.

"It's more like it is now, than it ever has been."
 
A starting point:
DoCmd.RunSQL "INSERT INTO yourTable (yourField) VALUES ('" & yourVariable & "')"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thanks PHV,
That works so well, I don't even need the second listbox. I can insert the item into the table from the first box. Problem is, each time I run this, I need to clear the contents of the table first. Any ideas on that?

Thanks.

"It's more like it is now, than it ever has been."
 
DoCmd.RunSQL "DELETE FROM yourTable"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
OOps, hit submit too fast ...
DoCmd.SetWarnings False
DoCmd.RunSQL "DELETE FROM yourTable"
DoCmd.SetWarnings True

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Excellent! Thanks very much! Works perfectly. Have a great holiday!

"It's more like it is now, than it ever has been."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top