Results 1 to 9 of 9
  1. #1
    Star Lounger
    Join Date
    Feb 2001
    Location
    New Zealand
    Posts
    63
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Command Buton - lookup? (Access Office XP)

    Hi,

    I have a form that I use to enter data. On this form I have some command buttons that query other tables via a parameter query eg sales by customer number, contact notes by customer number etc. These tables are updated either from this form, or other forms.

    What I would like to be able to do is if I am entering data for customer eg 895 is click on the command button for notes on this customer and have the customer number "flow" through to it. I can use a sub form and view the raw data , but prefer a report based on the parameter query.

    I am trying to avoid having to key in the customer number and hence avoid my tendency to miskey the number!

    Any ideas would be gratefully received.

    Thanks.......Peter

  2. #2
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Newbury, Berkshire, England
    Posts
    712
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Command Buton - lookup? (Access Office XP)

    Why not make a report based on your parameter query and run that with a command button?

  3. #3
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Command Buton - lookup? (Access Office XP)

    I'd make a report to run when the command button was clicked. And rather then setting up parameters in the query, I'd use the WHERE clause in the OpenReport method to specify the customer I wanted.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Command Buton - lookup? (Access Office XP)

    That limits the usefulness of the report. Using the WhereCondition argument of the OpenReport command allows you to run the report either way, for all records or for the current record on the form.
    Charlotte

  5. #5
    Star Lounger
    Join Date
    Feb 2001
    Location
    New Zealand
    Posts
    63
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Command Buton - lookup? (Access Office XP)

    Hi,
    I am still pretty new at this stuff. I am unsure what you mean by a where clause in the open reportmethod. The command buttons also (in three cases) run a select query to allow editing "on the fly" of previously entered notes on a given customer.

    Regards...Peter

  6. #6
    Star Lounger
    Join Date
    Feb 2001
    Location
    New Zealand
    Posts
    63
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Command Buton - lookup? (Access Office XP)

    Hi, I have done that already. The challenge comes as there are a large number of customers (200+). I am OK in doing a report based on a parameter query. What i am trying to do is avoid having to keep keying in the customer number. Customer number is my unique ID for each distinct customer.
    Regards...Peter

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

    Re: Command Buton - lookup? (Access Office XP)

    What the other guys are saying about the OpenReport command is the following:

    stDocName = "rpt MidWk Hdr Det"
    DoCmd.OpenReport stDocName, acPreview,, "CustomerID=" & CustID

    where CustID is the customer ID you have defined on your form.
    If you do it this way you don't need the parameter in the query, in fact you are doing it here.
    HTH
    Pat

  8. #8
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Command Buton - lookup? (Access Office XP)

    If you lookup the OpenReport method in Help, you will notice the command syntax references a Where clause. This enables you to create a report without having to worry about if it is for one customer or all customers. If you then call the report from a form, you can specify the report parameters in the WHERE clause.

    This is a mute point, however, as It appears that your command buttons are opening queries. I would prefer having suforms to handle the chores you are delegating to the queries.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  9. #9
    Star Lounger
    Join Date
    Feb 2001
    Location
    New Zealand
    Posts
    63
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Command Buton - lookup? (Access Office XP)

    Thanks for all the help on this I can do it that way. Once again, I am grateful for the help.

    Regards...Peter

Posting Permissions

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