Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Help opening up query into form

Discussion in 'Information Technology' started by mwest, Jul 28, 2006.

  1. mwest

    mwest
    Expand Collapse
    Guest

    I have a query called retreived selected contaminant,department,date and the
    code below however when I enter the information below it gives me a blank
    form instead of the information I requested.

    Private Sub MultiOK_Click()
    On Error GoTo b
    If IsNull(Me.Combo0) Or IsNull(Me.Combo2) Then
    MsgBox "Please include all criteria for the report.", vbInformation, "Some
    nifty title here."
    Me.Combo0.SetFocus
    GoTo a
    End If
    Me.Visible = False
    DoCmd.OpenForm "contaminant,department,date Display"
    DoCmd.Close acForm, Me.Name
    DoCmd.SelectObject acForm, "contaminant,department,date Display"
    a: Exit Sub
    b: MsgBox Err.Number & " " & Err.Description
    Resume a
    End Sub
     
  2. Loading...


  3. strive4peace

    strive4peace
    Expand Collapse
    Guest

    Instead of putting the criteria in your query, try using the
    WHERECLAUSE parameter of the Openform action

    DoCmd.OpenForm formname[, view][, filtername][,
    wherecondition][, datamode][, windowmode][, openargs]

    for help on OpenForm, press the F1 key on the word
    "OpenForm" in your code or in the Immediate window

    you also should replace the commas with underscores in your
    formname. It is a good idea to only use letters, numbers
    (but never as the first character), and underscores in
    tablenames, fieldnames, fornmames, etc -- and avoid using spaces

    Warm Regards,
    Crystal
    Microsoft Access MVP 2006

    *
    Have an awesome day ;)

    remote programming and training
    strive4peace2006 at yahoo.com

    *

    mwest wrote:
    > I have a query called retreived selected contaminant,department,date and the
    > code below however when I enter the information below it gives me a blank
    > form instead of the information I requested.
    >
    > Private Sub MultiOK_Click()
    > On Error GoTo b
    > If IsNull(Me.Combo0) Or IsNull(Me.Combo2) Then
    > MsgBox "Please include all criteria for the report.", vbInformation, "Some
    > nifty title here."
    > Me.Combo0.SetFocus
    > GoTo a
    > End If
    > Me.Visible = False
    > DoCmd.OpenForm "contaminant,department,date Display"
    > DoCmd.Close acForm, Me.Name
    > DoCmd.SelectObject acForm, "contaminant,department,date Display"
    > a: Exit Sub
    > b: MsgBox Err.Number & " " & Err.Description
    > Resume a
    > End Sub
     

Share This Page