need help fast running out of time

As I understand it, you are looking to:

1. Select 15 random items chosen from the complete list of items from Category CHEESE and DOUGH

2. Select 15 random items chosen from the complete list of items from Category SAUCE, MEAT, TOPP, and FZPIZ

3. Select 5 random items from the complete list of items from Category BAKERY, COND, ITAL, CP, MISC and POTATO

4. Select 5 random items from the complete list of items from Category DRINK, EQUIP, FRUIT, HARDWA, PAPER and ACCES.

5. Report the total random selection.


If this is the case, the updated file I just attached should fulfill your requirement. I created a copy of the table INVENTORY_1, INVENTORY_1_RPT, which is populated with the randomly selected data when the report is run, and cleared when the report is closed. The function code is in the Report's Code Module.

See if this solution works for you.
 

Attachments

Not relating to the solution or later suggestions, but the below statement from the first reply...

> I'm not sure where you intended to go with this code, but to clarify, the .Execute member of the ADODB Connection object is for the execution of an Action query, not for the return of data to a RecordSet.

Check out the help file for the Execute method of ADO connection. It can very well be used to return a recordset. The recordset will be readonly, forwardonly.

Small sample

dim rs as adodb.recordset
set rs = currentproject.connection.execute("SELECT * FROM sometable", ,adcmdtext)
debug.print rs.getstring
 
Whoop, my bad, my mindset was in DAO.

Yes, you're right, you can use the .Execute member of the ADODB.Connection object to return a recordset.

However, for what gizmogeek was trying to accomplish, simply instantiating a data-populated recordset would not have accomplished the intended task. The solution I provided should fulfill the requirement as it was stated in gizmogeek's more recent post of the specific criteria.

Let us see what gizmogeek has to say as to whether we have been of help in solving this problem.
 

Users who are viewing this thread

Back
Top Bottom