Run a query through a form button

naobao

Registered User.
Local time
Today, 01:54
Joined
Feb 13, 2014
Messages
99
Hi,


How to filter the query value when I click different button on the form,
Please check the picture
 

Attachments

  • 1.png
    1.png
    51.2 KB · Views: 104
  • 2.png
    2.png
    31.3 KB · Views: 107
If I was going to do it, I wouldn't open the query. Instead, I would create a datasheet form based on the query, and then use the OpenForm method where you could pass a filter/criteria in the WhereCondition argument to limit the data displayed.
 
pass a filter/criteria in the Where Condition argument
But there are 175 different arguments to be made? If the boss said I had to make this work as is, I'd select all of those buttons in design view and set their click event to call one function. That function could accept either the button name or caption as an argument, but that would require providing that info for each separate button, either through the function call or tag property. I might try to just use ActiveControl property instead.

However, given free rein, I'd start over with a different form design.
 
I think use a functon to do it is good, but I don't know how to do...
 
By the way, I agree with tBD's suggestion to filter a form but rather than have 175 Click events (1 for each button) have just one function is what I'm saying. You don't seem to have that form yet. Why not create that and post back - preferably with a db copy?
 
Why do you've all that buttons on the form?
Could a combo box not work for you?
 

Users who are viewing this thread

Back
Top Bottom