Welcome to SPN

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

Sign Up Now!

Repetitive Query Question

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

  1. 72185

    72185
    Expand Collapse
    Guest

    I asked this question before but the responses I got were leading me in
    a different direction.

    I have a query that has four parameters in it. I use a button to open
    up a form that has a subform inside it and that is where I put that
    query (search qry). My problem is that when I click the button the
    question parameters appear and work properly except it will ask the
    question twice. This is not a huge deal but I think it looks less
    professional.

    If anyone might have any ideas or solutions to this please let me know

    Thanks,

    -W
     
  2. Loading...

    Similar Threads Forum Date
    Query about Jhatka Meat by Shooting in Head Sikh Sikhi Sikhism Aug 26, 2011
    Who is a sikh? A non sikh friend's query!! Sikh Sikhi Sikhism Apr 30, 2010
    General Query Hard Talk Sep 4, 2008
    Power of pauri's in Japji Sahib query Sikh Sikhi Sikhism Aug 17, 2006
    Sikhism a query Book Reviews & Editorials Aug 2, 2005

  3. Sharkbyte

    Sharkbyte
    Expand Collapse
    Guest

    It's difficult, without seeing the form/subfrm in action, but it sounds like
    you have the query somehow running twice. You might take a look at how you
    call the query.

    If the query is called, when the subform is loaded, are you running a
    Requery step, from the form?

    Again, it's difficult to offer much, without seeing the form running.

    Sharkbyte


    "72185" wrote:

    > I asked this question before but the responses I got were leading me in
    > a different direction.
    >
    > I have a query that has four parameters in it. I use a button to open
    > up a form that has a subform inside it and that is where I put that
    > query (search qry). My problem is that when I click the button the
    > question parameters appear and work properly except it will ask the
    > question twice. This is not a huge deal but I think it looks less
    > professional.
    >
    > If anyone might have any ideas or solutions to this please let me know
    >
    > Thanks,
    >
    > -W
    >
    >
     
  4. 72185

    72185
    Expand Collapse
    Guest

    I have the query running before the form appears. So the questions get
    asked before anything else. is there another way to put the subform in
    the form that make it not ask twice? Or maybe a way to adjust the
    parameters?

    Thanks for your help,

    -W
     
  5. Sharkbyte

    Sharkbyte
    Expand Collapse
    Guest

    Can you not load the query before the form? From what you are saying, you
    initiate the query, causing it to ask for the parameters; then when the form
    opens, and you put the query in the form, it is actually running the query
    again.

    If you can not load the query, before the form, then it will only ask for
    the parameters when you load the form/subfrm.

    Sharkbyte



    "72185" wrote:

    >
    > I have the query running before the form appears. So the questions get
    > asked before anything else. is there another way to put the subform in
    > the form that make it not ask twice? Or maybe a way to adjust the
    > parameters?
    >
    > Thanks for your help,
    >
    > -W
    >
    >
     
  6. 72185

    72185
    Expand Collapse
    Guest

    I have a button with a macro command. I just have it set up to just
    open the form. The query is in the subform on that form. I don't know
    why it just runs on its own because I don't have any commands that are
    telling the query to run. Then when it does run its asks those
    parameters twice which is where I'm stuck.

    Is there a way to make the subform not run the query until the form
    appears? Or maybe set it up to run differently?

    Thanks for your help,

    -W
     
  7. Pat Hartman\(MVP\)

    Pat Hartman\(MVP\)
    Expand Collapse
    Guest

    The subform opens, then the main form opens, then the subform opens again.
    That's just the way it is. There are two ways around the problem.
    1. Use a form to collect the parameters and change the query to reference
    the form rather than prompt.
    2. Remove the query from the subform's RecordSource. Then in the load event
    of the mainform, put it back:

    Me.MySubform.Form.RecordSource = "queryname"

    "72185" <ws72185@yahoo.com> wrote in message
    news:1152125071.313889.77490@j8g2000cwa.googlegroups.com...
    >
    > I have a button with a macro command. I just have it set up to just
    > open the form. The query is in the subform on that form. I don't know
    > why it just runs on its own because I don't have any commands that are
    > telling the query to run. Then when it does run its asks those
    > parameters twice which is where I'm stuck.
    >
    > Is there a way to make the subform not run the query until the form
    > appears? Or maybe set it up to run differently?
    >
    > Thanks for your help,
    >
    > -W
    >
     
  8. DTecMeister

    DTecMeister
    Expand Collapse
    Guest

    It sounds like you have the subform linked to the main form. This
    isn't necessary (it sounds like). If you remove the linkage, you should
    be all set.

    72185 wrote:
    > I asked this question before but the responses I got were leading me in
    > a different direction.
    >
    > I have a query that has four parameters in it. I use a button to open
    > up a form that has a subform inside it and that is where I put that
    > query (search qry). My problem is that when I click the button the
    > question parameters appear and work properly except it will ask the
    > question twice. This is not a huge deal but I think it looks less
    > professional.
    >
    > If anyone might have any ideas or solutions to this please let me know
    >
    > Thanks,
    >
    > -W
     
  9. 72185

    72185
    Expand Collapse
    Guest


    > 2. Remove the query from the subform's RecordSource. Then in the load event
    > of the mainform, put it back:
    >
    > Me.MySubform.Form.RecordSource = "queryname"


    I tried that example, but it has a problem with the RecordSource. So I
    didn't know if I was typing it in wrong or have the wrong concept.
    Here is what I have.

    Me.Search.Modify Search.RecordSource = "modify subform qry"

    Search = name of the subform on the main form.


    Would you happen to have any examples ?
     
  10. Larry Linson

    Larry Linson
    Expand Collapse
    Guest

    Ooh, looks like our sloppy use of "subform" has struck again.

    For the Record: There is no Subform object in Access. There is a Subform
    Control (and corresponding Subreport Control for Reports) into which you can
    embed a Form. The embedded Form in a Subcontrol is not "open" when it is
    displayed, and, thus, not in the Forms Collection; it exists as the Form
    property of the Subform Control. From VBA code in the parent Form's module
    you can address that Form and its Properties this way:

    Me!nameofsubformcontrol.Form.nameofproperty

    I can't make heads nor tails out of the statement you included, or is it two
    statements separated by a space?

    From outside, as in a Standard Module:

    Forms!nameofmainform!nameofsubformcontrol.Form.nameofproperty

    Larry Linson
    Microsoft Access MVP

    "72185" <ws72185@yahoo.com> wrote in message
    news:1152193130.144970.92380@m79g2000cwm.googlegroups.com...
    >
    >> 2. Remove the query from the subform's RecordSource. Then in the load
    >> event
    >> of the mainform, put it back:
    >>
    >> Me.MySubform.Form.RecordSource = "queryname"

    >
    > I tried that example, but it has a problem with the RecordSource. So I
    > didn't know if I was typing it in wrong or have the wrong concept.
    > Here is what I have.
    >
    > Me.Search.Modify Search.RecordSource = "modify subform qry"
    >
    > Search = name of the subform on the main form.
    >
    >
    > Would you happen to have any examples ?
    >
     
  11. Pat Hartman\(MVP\)

    Pat Hartman\(MVP\)
    Expand Collapse
    Guest

    I did include the ".Form" reference in the example. 72185 left it out. I
    think the problem also has to do with a poorly formed name that includes a
    space.

    72185 - it is better practice to not use embedded spaces or any special
    characters when naming tables/columns/controls/etc. VBA, like all
    programming languages, has trouble working with these invalid names. To
    overcome the problem, VBA changes any non-allowed characters such as space,
    #, %, etc. with underscores. Be very careful with this because if there are
    multiple spaces, there will be multiple substitute underscores.

    So - Me.Search.Modify_Search.Form.RecordSource = "modify subform qry" may
    work
    or - Me.Search.[Modify Search].Form.RecordSource = "modify subform qry"

    Don't forget the ".Form". It is necessary in this case because you need to
    reference a property of the form within the subform control.

    Also - Modify_Search needs to be the name of the subform control which may
    or may not be the same as the name of the subform. You can see the
    subform's Control Name by opening the control's properties and looking at
    the Name property on the Other tab.


    "Larry Linson" <bouncer@localhost.not> wrote in message
    news:%23viCMEUoGHA.1248@TK2MSFTNGP05.phx.gbl...
    > Ooh, looks like our sloppy use of "subform" has struck again.
    >
    > For the Record: There is no Subform object in Access. There is a Subform
    > Control (and corresponding Subreport Control for Reports) into which you
    > can embed a Form. The embedded Form in a Subcontrol is not "open" when it
    > is displayed, and, thus, not in the Forms Collection; it exists as the
    > Form property of the Subform Control. From VBA code in the parent Form's
    > module you can address that Form and its Properties this way:
    >
    > Me!nameofsubformcontrol.Form.nameofproperty
    >
    > I can't make heads nor tails out of the statement you included, or is it
    > two statements separated by a space?
    >
    > From outside, as in a Standard Module:
    >
    > Forms!nameofmainform!nameofsubformcontrol.Form.nameofproperty
    >
    > Larry Linson
    > Microsoft Access MVP
    >
    > "72185" <ws72185@yahoo.com> wrote in message
    > news:1152193130.144970.92380@m79g2000cwm.googlegroups.com...
    >>
    >>> 2. Remove the query from the subform's RecordSource. Then in the load
    >>> event
    >>> of the mainform, put it back:
    >>>
    >>> Me.MySubform.Form.RecordSource = "queryname"

    >>
    >> I tried that example, but it has a problem with the RecordSource. So I
    >> didn't know if I was typing it in wrong or have the wrong concept.
    >> Here is what I have.
    >>
    >> Me.Search.Modify Search.RecordSource = "modify subform qry"
    >>
    >> Search = name of the subform on the main form.
    >>
    >>
    >> Would you happen to have any examples ?
    >>

    >
    >
     
  12. 72185

    72185
    Expand Collapse
    Guest

    Thanks guys for your help! I finally got it up and running properly.

    Thanks agian,

    -W
     

Share This Page