Results 1 to 6 of 6
  1. #1
    Join Date
    Jun 2004
    Location
    Seattle, WA
    Posts
    601

    Unanswered: Using a form to run a query

    I am having a blonde moment...I have a query that combines by year. I built a form on that query. Then I opened up the query and put the following into the criteria field:
    Forms![frmByYear]![cmbByYr]
    When I re-open the form, it either pops up with enter the year in an access default dialogue box, or the form is blank..all the controls are gone.

    Next the drop down for the employees isn't selectable. This is a look up column in the Registery table which goes from the employee table.

    What I am trying to do is make a form, that allows an employee to be picked and a yearly report to be drawn up. It'd be nice if I could get the all option to work like it was described here. I get an SQL error when I do that method and a VBA error doing the other way. Thanks
    Ryan
    My Blog

  2. #2
    Join Date
    Dec 2005
    Location
    Texas
    Posts
    100
    If the form is blank you might want to see if there's any data in the table it's referencing.

  3. #3
    Join Date
    Apr 2004
    Location
    metro Detroit
    Posts
    634
    Is the form that you are trying to open frmByYear?

  4. #4
    Join Date
    Jun 2004
    Location
    Seattle, WA
    Posts
    601
    Disruptive: I built the query, and made a form off that query.

    Rogue: Yes.
    Ryan
    My Blog

  5. #5
    Join Date
    Apr 2004
    Location
    metro Detroit
    Posts
    634
    1) You're trying to use the value of a control on the form as criteria in the query underlying the form. Since the form is not yet open and there is no value in the control, access asks the user for the value. Either of the following should take care of that problem.

    Create a seperate form with cmbByYear and a button to open frmByYear and set the query criteria to cmbByYear on the new form.

    -or-

    Remove the criteria from the query and add code to the change event of cmbByYear (I'm asuming this is a combo box) to filter the data on the form.


    2)Is the drop down bound to a field? Is the bound column of the drop down the same data type as the field? Can you update this field in the underlying query?


    3)Please post the code that you are using for the all option>

  6. #6
    Join Date
    Jun 2004
    Location
    Seattle, WA
    Posts
    601
    2) The drop down is bound.
    Ryan
    My Blog

Posting Permissions

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