Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I link a command button to a query or a report?

Status
Not open for further replies.

mouk2007

Programmer
Jul 15, 2008
11
GB
I have created a form so that users can select one of the following options:
1 - Select Actor
2 - Enter Actor
3 - All Actors
and based on their choice either a drop-down menu appears allowing the user to select an actor name or type in the actor name for the DVDs by that actor to appear. I have also created a command button.
However I want to know how I would be able to show the appropriate query or report based on the option the user selects so that when the user selects one of the 3 options, enters/selects the actor name and clicks on the combo box the appropriate query/report shows up.

Many Thanks
 
I dont know exactly but i can point you to the right direction:D

** if im mistaken please let somebody change this:D **

put in VBA on the button (click)

If me.selectactor = "*" Then
docmd.openquery "queryname" *or* docmd.openreport "reportname",,,[selectactor]=" & [actor]
Else
If me.enteractor = "*" Then
docmd.openquery "queryname" *or* docmd.openreport "reportname",,,[selectactor]=" & [actor]
Else
me.allactors = "*" Then
docmd.openquery "queryname" *or* docmd.openreport "reportname",,,[selectactor]=" & [actor]

End if
End if

I would use a report because i dont know how to set a WHERE into that, but maybe someone else does:D

* [selectactor] = name of the combobox
* [actor] = name in the report

hope this helps:D

Greetz
Superguppie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top