button instead of combo box

tubar

Registered User.
Local time
Today, 09:00
Joined
Jul 13, 2006
Messages
190
if i wanted a button to represent a value so when i pressed a certain one it would use that value as an id used to combinde a report.

example i have 100 different locations in a building which are each represented by an id...i have a form with the floor plan and then place invisble buttons ontop of certain locations. i then have 100 reports...so when i hit a button it loads a certain report....

at the end of the day i want to use 1 report not 100
 
Last edited:
A couple of options iff the top of my head:

ONE:
When you click on the button, you could store the ID value in an invisible textbox, that is used in the underlying query of the report eg WHERE LocationID = Forms!FloorPlans!txtLocationID

Code:
Onclick: 
txtLocationID = [ID] 'replace with the value of your ID field

TWO:
Use the same idea as option ONE but add the code to open the report with the where clause option.
Code:
Onclick: 
txtLocationID = [ID] 'replace with the value of your ID field
DoCmd.OpenReport "reportname", , , "LocationID = " & txtLocationID


THREE:
Store the location ID in the Tag property of the button so that when it is pressed you can refer to is in you OpenReport code. I have not used tags for this purpose, but it should work.

Code:
DoCmd.OpenReport "reportname", , , "LocationID = " & cmdButton1.Tag

The examples assume you ID field is numeric.
 

Users who are viewing this thread

Back
Top Bottom