Results 1 to 4 of 4
  1. #1
    New Lounger
    Join Date
    Jun 2005
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Forms And Queries (Access 2003)

    I use Access 2003, and have a form with a subform in it. I am trying to run a report based on a query. The query should only pull the information that is from the current record on the subform. However, every time I go to run the query I get a text box popping up asking me for the record I would like to pull. The query is not recognizing that the subform is open. I assume it only recognizes the form being open, because I have tried that and it has worked. Any suggestions. If there is anyway to just print the current record without using a query, I open to that as well.

    Thanks in advance

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

    Re: Forms And Queries (Access 2003)

    You haven't told us how exactly you open the report, but I assume you use DoCmd.OpenReport with a Where-condition. If you want to refer to a control on a subform in the Where-condition, you must do it as

    Forms!frmMainForm!frmSubForm!ctlName

    where frmMainForm is the name of the main form, frmSubForm is the name of the subform as a control on the main form, and ctlName is the name of the control.

    Note: the name of the subform as a control on the main form is not necessarily the same as the name of the subform in the database window. Open the main form in design view and click once on the subform to see its name in the Properties window.

  3. #3
    New Lounger
    Join Date
    Jun 2005
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Forms And Queries (Access 2003)

    I open the report using a command button, that has the DoCmd.OpenReport code. However I actually pull the current record from the subform in the query. That way the query is not calculating all of the records at once, only the current record that I need.

    Thanks for all your help

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

    Re: Forms And Queries (Access 2003)

    Can you tell us how you "pull the current record from the subform in the query"?

Posting Permissions

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