Passing Value to Access Report

indy.gill

New member
Local time
Today, 22:28
Joined
Jan 4, 2005
Messages
4
Hi

Im a bit of a newbie to Access development as i normally develope in ASP.NET. However I was wondering if the good people of this forum could give a bit of help.

Problem 1
I have a form which has a button it which opens up a reports, I would liek to pass the user id to the report so it only show teh details for teh specific user. Can I put something in my select query, maybe something like SELECT * FROM Users WHERE UserID = Form_MyForm.UserID.Value ? Is this possible?

Problem 2
I have a combo box, I would like to filter its contents when the page is loaded by a paraamter I have passed to the form. For example I have a dropdown list of Cars, I know that my user only wants to see Four Wheel drive vehicles in the list so I would liek to reduce the combo list of cars to ony show Four Wheel drive vehicles.

Any help would be much appeciated, many thanks in advance
 
Problem 1
I have a form which has a button it which opens up a reports, I would liek to pass the user id to the report so it only show teh details for teh specific user. Can I put something in my select query, maybe something like SELECT * FROM Users WHERE UserID = Form_MyForm.UserID.Value ? Is this possible?
Use this:

DoCmd.OpenReport "YourReportNameHere",acViewPreview,,"[UserID]=" & Me!UserID

if the UserID is a number and if it is text use:

DoCmd.OpenReport "YourReportNameHere",acViewPreview,,"[UserID]='" & Me!UserID & "'"


Problem 2
I have a combo box, I would like to filter its contents when the page is loaded by a paraamter I have passed to the form. For example I have a dropdown list of Cars, I know that my user only wants to see Four Wheel drive vehicles in the list so I would liek to reduce the combo list of cars to ony show Four Wheel drive vehicles.
Look up Cascading Combo Box here.
 
Hi, first can I say thanks for teh reply much appeciated.

Your solution for problem 1 worked a treat, thanks!

With regards to Problem 2 im still having trouble. I dont think I may have xplained it very well in my posting. I have a combo list which list everything from a table, for example a list of car types. The drop down list shows all the cars in teh table. However when a user is loaded they can have already predifined the car types they want to see. So on form load I want to take the users selection prefernces and reduce the combo box list by these types.

Many thanks in advance
 

Users who are viewing this thread

Back
Top Bottom