Results 1 to 8 of 8
  1. #1
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Toronto Canada
    Posts
    920
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Dynamic query switch (A2K)

    Iíve probably used the wrong subject name, but couldnít think of anything better.

    I have a form which uses a query that has a function code.

    The function codes run from 1 thru 39.

    Without exiting the form Iíve tried creating a command button that selects a specific group of function codes.

    Private Sub Command3262_Click()
    DoCmd.OpenQuery "qry 01 CN - 02 - Function_09_19_28_38", acNormal, acEdit
    End Sub

    It unfortunately does exactly what Iíve asked it too, that is opens the query with the selected codes.

    What I really want if to do is to run the query and display the selected records in the form and then hopefully be able to reset it after.

    I did go through the Forum with various search criteria, but couldnít come up with the right combination to find the answer I wanted.

    As always, thanks in advance for any help on this,
    Cheers,
    Andy

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Dynamic query switch (A2K)

    Is the record source of the form a table or query with the same fields as qry 01 CN - 02 - Function_09_19_28_38?

  3. #3
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Toronto Canada
    Posts
    920
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Dynamic query switch (A2K)

    Hi Hans,

    Yes it is a copy of the original query with the selections coded in.i.e. 9 , 19, 28, 39
    Cheers,
    Andy

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Dynamic query switch (A2K)

    Try this:

    Me.RecordSource = "qry 01 CN - 02 - Function_09_19_28_38"

    When you want to restore the original record source, use

    Me.RecordSource = "Name_of_original_query"

    substituting the appropriate name.

  5. #5
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Toronto Canada
    Posts
    920
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Dynamic query switch (A2K)

    Hans, Hans, Hans,

    Just can only say Thank You again.

    ps.

    A friend of mine doesn't believe you exist, but are really a huge HAL-like computer somewhere. aka HANS
    Cheers,
    Andy

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Dynamic query switch (A2K)

    IBOT minus 1?

    The secret is finally out... <img src=/S/grin.gif border=0 alt=grin width=15 height=15>

  7. #7
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Dynamic query switch (A2K)

    He must be real, computers don't have a sense of humour.

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Dynamic query switch (A2K)

    That's .... what ... you ... think .... (Click)

Posting Permissions

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