Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    Sep 2007
    Location
    Chatham, Kent, England
    Posts
    214
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Opening a Report based on a Combo selection (2000)

    My database records materials ordered for jobs. I have a report which lists Materials per Order Number per Site per Engineer. The report is based on a parameter query to limit the report to each Engineer. The user types the Engineer Name to list the above details for that Engineer.

    All quite straightforward so far!

    What I would like to do is to select the Engineer name from a drop down list instead of typing it to save errors due to spelling etc.

    What would be the best approach for this? I've created a new form with a Combo Box on it based on the Engineer table. The after update event has a docmd open report but I'm having problems with the WHERE part to get the name selected in the combo into the Query Engineer name criteria.

    Can somebody give me a pointer on the coding for this or is there a better way of doing it?

    Regards

    Graeme

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

    Re: Opening a Report based on a Combo selection (2000)

    Post your attempt at the SQL. Otherwise, we're just guessing about the tables and controls involved.
    Charlotte

  3. #3
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Opening a Report based on a Combo selection (2000)

    This code suppose the Engineer id is the field bounded to your combobox.
    <pre> Dim stDocName As String
    Dim strCriteria As String
    strCriteria = "[EngineerID] = " & Me.cmbMyCombo
    stDocName = "YourReport"
    DoCmd.OpenReport stDocName, acPreview, , strCriteria</pre>

    If your EngineerID field is a text field change the strcriteria line to:<pre> strCriteria = "[EngineerID] = '" & Me.cmbMyCombo & "'"</pre>

    Francois

  4. #4
    2 Star Lounger
    Join Date
    Sep 2007
    Location
    Chatham, Kent, England
    Posts
    214
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Opening a Report based on a Combo selection (2000)

    Francois

    Works lovely thanks! I'll do it with all the reports now.

    Regards

    Graeme

Posting Permissions

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