Dialogs & Queries & Forms, **OH MY** Help!!

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Marina

    #1

    Dialogs & Queries & Forms, **OH MY** Help!!

    Ok here's my problem....

    I have a custom dialog box that allows the user to enter information to
    run a Parameter Query. This works GREAT, but I need that query to show
    as a form, not just the basic query screen. I have created the form,
    but how in the world do I get it to open based on the parameter query
    created by the user.

    Ugg... ok now even I'm confused... what a tangled web we weave...
    GRRRRR

    To simplify...

    1) user opens frmRecordSearch

    2) user enters the paramiters for the query, ie. ClientID or CaseNumb,
    and clicks ok

    3) the ok button runs the Query using the following code:
    Private Sub cmdOK_Click()
    DoCmd.OpenQuery "qryCaseFil es",
    acViewNormal, acEdit
    DoCmd.Close acForm, "frmRecordSearc h"
    End Sub
    4)User see's the query results...

    How can I display the results in a form not the query window???

  • Allen Browne

    #2
    Re: Dialogs & Queries & Forms, **OH MY** Help!!

    Set the form to Continuous View, so it shows one record per row.

    Put the unbound controls where the user enters their search parameters into
    the Form Header section.

    Put the name of the query into the RecordSource of the form.

    In the Criteria of the query, enter things like:
    Forms!frmRecord Source!txtCaseN umb
    where txtCaseNumb represents the name of the unbound text box on the form.

    There are actually some limitations to that simple approach, e.g. where you
    don't want to use all the search boxes, or where the query is not able to
    find the boxes on the form when it first opens. A more powerful solution is
    leave the criteria out of the query, and build up a string to use as the
    Filter of the form. This is much more flexible and efficient, but does
    require some VBA skills. You can download an example for Access 2000 and
    later here:


    --
    Allen Browne - Microsoft MVP. Perth, Western Australia.
    Tips for Access users - http://allenbrowne.com/tips.html
    Reply to group, rather than allenbrowne at mvps dot org.

    "Marina" <maiden_moon@ea rthlink.net> wrote in message
    news:1143710310 .426501.92830@i 39g2000cwa.goog legroups.com...[color=blue]
    > Ok here's my problem....
    >
    > I have a custom dialog box that allows the user to enter information to
    > run a Parameter Query. This works GREAT, but I need that query to show
    > as a form, not just the basic query screen. I have created the form,
    > but how in the world do I get it to open based on the parameter query
    > created by the user.
    >
    > Ugg... ok now even I'm confused... what a tangled web we weave...
    > GRRRRR
    >
    > To simplify...
    >
    > 1) user opens frmRecordSearch
    >
    > 2) user enters the paramiters for the query, ie. ClientID or CaseNumb,
    > and clicks ok
    >
    > 3) the ok button runs the Query using the following code:
    > Private Sub cmdOK_Click()
    > DoCmd.OpenQuery "qryCaseFil es",
    > acViewNormal, acEdit
    > DoCmd.Close acForm, "frmRecordSearc h"
    > End Sub
    > 4)User see's the query results...
    >
    > How can I display the results in a form not the query window???[/color]


    Comment

    • Ron2005

      #3
      Re: Dialogs &amp; Queries &amp; Forms, **OH MY** Help!!

      An alternative -

      A - assuming that the new form with the query on it is called
      "MynewQuery form"

      3) the ok button runs the Query using the following code:
      Private Sub cmdOK_Click()
      ' DoCmd.OpenQuery
      "qryCaseFil es",
      DoCmd.Openform "MynewQuery form"


      There are other parameters to openform that will show up and you can
      use whatever of those that you want.

      Ron

      Comment

      • Marina

        #4
        Re: Dialogs &amp; Queries &amp; Forms, **OH MY** Help!!

        thank you, thank you, thank you!!!

        Comment

        Working...