Printing a single label

jbaccess

Registered User.
Local time
Today, 06:34
Joined
Jan 17, 2012
Messages
21
I am wanting to print a single label after entering in an inventory item by clicking a command button.

What I end up getting is the whole database (which is now more than 1,000 records). How do I narrow that down to the latest / current entry?
 
Presumably your command button opens a report. Use a Where condition in the OpenReport method to limit the results to only the current record (usually via the record's PK field).
 
My command button does open the report, but in my where condition, I have not been able to identify "how" to only pick the last PK?

I'm sure this is simple, but I either get everything or the very first item entered.

Thanks
 
Assuming that the record you want to print a label for is the current record (in your form), and that the record source of the report also contains the same PK field that the record source of the form does, then the syntax should look something like;

DoCmd.OpenReport "YourReport", , , "[PK Field]=" & Me![PK Field]
 
That didn't work.

What I have done so far is to create a macro that does print out, but now I'm only able to filter down to the day in my query. So instead of the whole database, I got the 25 records that were created this morning. Any suggestions on how to get it to the last record.

I also tried GoToRecord [last] when the report opens, but get a 2950 error code and told I can't go to the specified record. I may be at the end of a recordset.

The tables I am printing from is [Inventory]:
with fields [Inventory ID], [Weight], [Quantity], and [Item].

thanks
 

Users who are viewing this thread

Back
Top Bottom