Results 1 to 2 of 2
  1. #1
    Star Lounger
    Join Date
    May 2002
    Location
    Patagonia Region Chile
    Posts
    78
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Set answers to query parameter prompt at form open (A2k)

    Hello...
    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.

    Thanks

    Jason

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 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
    Me.txtParameter.SetFocus
    MsgBox "Please enter a parameter value.", vbExclamation
    Exit Sub
    End If
    DoCmd.OpenForm FormName:="Form1", WhereCondition:="Field1 = " & Me.txtParameter
    End Sub

    The actual code will depend on the names of the text box, command button, form and field and of the field type.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •