Full Version: Need Code For One Button that Will Look at multiple Queries
UtterAccess Forums > Microsoft® Access > Access Forms
I have a Form where informatin is entered in one of 5 text boxes. I have a button for each of text boxes that uses the query tied to each text box. I would like to have one button that could take the data entered and look at the five queries and use the appropriate one.
Can you help me with this?
"use the appropriate one"
How does the db know the appropriate one?
With that additional info one can probably structure a solution.
Here is what I have so far:
- On my form I have different text fields; RP, MP, VBU (someone using the database will enter a number in one of these fields)
- Right now I have a different button for each of the text fields that is tied to a it's own query
That I want is only to have one button that can take the number entered and run the query that is tied to that text field.
if only one field will have data then one would need an if/then statement (or Case method) to determine which field has data.
You should be able to make a button; and in its OnClick event put the code behind each of the other buttons. And then wrap each with an if/then so the correct one is triggered.
Something like:
If Not IsNull(me.RP) then
....code from the RP button here....
end if
Only 1 should ever not be null. If there is any possibility of data in more than one field then of course one has to resolve that dilemma.
hope this points a way for you to follow.
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.