Results 1 to 2 of 2
2009-01-16, 19:08 #1
- Join Date
- May 2002
- Patagonia Region Chile
- Thanked 0 Times in 0 Posts
Set answers to query parameter prompt at form open (A2k)
I have a query that is used for form1 and form2 and reports. Form 1 requires the user to input a parameter which the query solicits with a pop up dialog as the query is run. When running Form 2 the answer to the pop up is always the same.
How can I cause that form to answer the parameter prompt and avoid the pop up for form 2 but but leave the query in tact so that it works for form 1.
2009-01-16, 19:30 #2
- Join Date
- Mar 2002
- Thanked 28 Times in 28 Posts
Re: Set answers to query parameter prompt at form open (A2k)
You could use separate queries for Form1 and Form2 - the former with a parameter and the latter without one.
Or you could use a single query without a parameter, and open Form1 from yet another form where the user enters the parameter in a text box. Use this text box in the WhereCondition argument of the code used to open Form1, for example:
Private Sub cmdOpen_Click()
If IsNull(Me.txtParameter) Then
MsgBox "Please enter a parameter value.", vbExclamation
DoCmd.OpenForm FormName:="Form1", WhereCondition:="Field1 = " & Me.txtParameter
The actual code will depend on the names of the text box, command button, form and field and of the field type.