Filtering report

d_profesor

Registered User.
Local time
Today, 09:20
Joined
Jan 17, 2008
Messages
43
Say, i have tabel or query : Asset ID, User ID, Movemen Date, Document Number. I want to print or preview a report for a given value of User ID.

what's the simplest way to do that?

Thanks..
 
Just open the report filtered:
Code:
DoCmd.OpenReport "YourReportNameHere", acViewPreview,,"[User ID]=" & Me![User ID]

If User ID is text and not a number then:
Code:
DoCmd.OpenReport "YourReportNameHere", acViewPreview,,"[User ID]='" & Me![User ID] & "'"
 
Thanks thats really simple..

the problem is i have to enter (type) an user id for that. I've a lot of user so i can't remember it.

Can i display them in a List Box first, choose one of them as a filter criteria, and display it in a report ? how can i do that?

Thanks again..
 
The Me![User ID], IF you actually have that in your underlying recordset,refers to the record currently selected - you don't have to type anything. If you get a prompt for that from Access then it means you are referring to something that doesn't exist within your recordset and you either have mispelled it (should be UserID instead of User ID, etc.) or you haven't included it as part of the query or table in the form.
 
The me![User ID] is a correct one, the thing i mean is when i click cmdPreview (I put the code in event cmdPreview_Click), Access ask me to enter a parameter (criteria), in this case an user id that i want to display in report.

I want to choose a parameter from a combobox, or listbox, not enter(type it), because i have many user and its difficult to remember them one by one.

Thanks
 

Users who are viewing this thread

Back
Top Bottom