Results 1 to 6 of 6

Thread: VBA Report Form

  1. #1
    Join Date
    Mar 2004
    Posts
    5

    Unanswered: VBA Report Form

    Hello,
    I am trying to create a form to pull information from 2 tables.
    I have a table called tblCOR and a table tblEXT. The first table holds data for PBXName, City, and COR. The second table holds PBXName, Display and Extension.

    I need to create a form os that one someone selects the PBXname from a dropdown list,they get a report of all extensions and Displays for that PBX Name.

    I tried some code Ifound elsewhere and tried to tweak it for my needs I and failed miserably. Can someone please help

    Thank you
    Jason

  2. #2
    Join Date
    Apr 2002
    Location
    Illinois
    Posts
    133
    On your form, create a combo box that uses the field PBXName in tblCOR as its record source.

    Create a query that has the fields you want on your report, using tblEXT as the record source. Set the Criteria for the PBXName field to equal the value in the combo box on the form.

    Create a report that uses the query as a record source.

    On the form, create a button that opens the report. The Command Button Wizard will do this quickly.

    You shouldn't have to do any VBA coding yourself this way.
    SteveH

  3. #3
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    On a sidenote, it's not generally a good idea to use string fields for keys, you may want to consider adding id fields to your tables.

  4. #4
    Join Date
    Mar 2004
    Posts
    5
    Originally posted by SteveH
    On your form, create a combo box that uses the field PBXName in tblCOR as its record source.

    Create a query that has the fields you want on your report, using tblEXT as the record source. Set the Criteria for the PBXName field to equal the value in the combo box on the form.

    Create a report that uses the query as a record source.

    On the form, create a button that opens the report. The Command Button Wizard will do this quickly.

    You shouldn't have to do any VBA coding yourself this way.
    This has helped a ton. I have only 1 more question. When I am setting the criteria in the query, What should I be entering? If I leave the criteria field blank, I get all of the Data. I have tried a few things in the criteria field without success.

  5. #5
    Join Date
    Apr 2002
    Location
    Illinois
    Posts
    133
    In the query, put your cursur in the Criteria field under PBXName and RIGHT click. Choose "Build". In the top box of the Expression Builder, type Forms!(form name)!(combo box name). Example: Forms!frmMainForm!cbName.

    When you get this working, spend some time reading about and experimenting with the Expression Builder in the online Help.
    SteveH

  6. #6
    Join Date
    Mar 2004
    Posts
    5
    SteveH,

    Thanks, I had figured it out about 5 minutes before You posted. I had forgotten the = sign in the expression.

Posting Permissions

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