|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Changing the Value of a Variable in a Query using VBA
I have a report that's based on a query with a criteria for a particular field being a user specified parameter (variable). Now when you open this report it obviously asks you for the parameter but what i've done is set an [On Open] event procedure that generates a menu which asks the user to enter a number based on what he wants the report to show. Each number corresponds to a particular value that the field can take. What I want to know is how to get the value that's generated (from the user selecting a number) into the Queries perameter so it opens the report showing those fields.
----------------------------------------------------------------------------------------- Choice: Nature = Val(InputBox("Please Enter One of The Following Numbers : 1 , 2 , 3 or 4")) Select Case Nature Case 1 [Queries]![qry_nature]![User_Choice] = "" Case 2 [Queries]![qry_nature]![User_Choice] = "Hardware" Case 3 [Queries]![qry_nature]![User_Choice] = "Software" Case 4 [Queries]![qry_nature]![User_Choise] = "Other" Case Else MsgBox "Please Enter A Valid Choice" Resume Choice End Select ----------------------------------------------------------------------------------- Here's a quick one I just wrote up, but it's generally the jist of what I want to do. If you could point out any problems with this code it would be much appreciated, as you can tell from my user name i'm not that experienced with VBA. At the moment is generates : "MA can't find the field '|' referred to in your expression" |
![]() |
| Viewing: ASP Free Forums > Database > Microsoft Access Help > Changing the Value of a Variable in a Query using VBA |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|