how to write a query which selects multiple records from a table at once for updating

hfs

Registered User.
Local time
Today, 10:25
Joined
Aug 7, 2013
Messages
47
Hi,
I need help regarding a query,
I have a list box whose data is inserted in a table named as "test0" ,now in a macro of vba i want to select all the items in the list box and create there pdf files in a folder at my desired location. So far i have managed to create a pdf file of single item ,but i want help to select multiple items at once ,

Code:
SELECT test0.ID, test0.item  FROM test0 WHERE (((test0.item)=[ItemNumber]));


So, in this query itemNumber are multiple and i want to create there pdf files at once ..just on a click of one button ?
 
Put the query results in a record set and loop through, doing the pdf process to each one

Code:
Dim rsItemsAs DAO.Recordset

Set rsItems = CurrentDb.OpenRecordset(SELECT test0.ID, test0.item  FROM test0 WHERE (((test0.item)=[ItemNumber])))

rsItems.MoveFirst
Do While Not rsItems.EOF

currentItemNumber=rsItems!ItemNumber

'do your pdf process here


rsItems.MoveNext
Loop

I'm not sure about the query part of that though - you will probably need to adjust it to return all the items you want in one go.
 
Thank you so much !! It worked :)
 

Users who are viewing this thread

Back
Top Bottom