Results 1 to 3 of 3
  1. #1
    4 Star Lounger
    Join Date
    Apr 2001
    Location
    Guatemala City
    Posts
    515
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Link with highlighted field (Win ME/Access 97)

    I would like to highlight a field on a sub-form, then click a command button and open a report using the highlighted field to select the information on the report. For example, I would like to highlight an invoice number on the sub-form and open a report with information only on that invoice. The sub-form is in datasheet view with several invoices visible.

    If this were a unique field on the main form, I could just reference the field with Form!Customer and limit the query to that invoice. Being in datasheet view with many invoices gives me problems.

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

    Re: Link with highlighted field (Win ME/Access 97)

    I'll assume that the subform is called MySubForm, couldn't you just reference the field on the subform like:

    Forms!MainForm!MySubForm.Form!InvoiceNo

    HTH
    Pat

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

    Re: Link with highlighted field (Win ME/Access 97)

    Pass the report a WhereCondition in the DoCmd.OpenReport statement

    DoCmd.OpenReport "ReportName", , , strWhereCondition

    The where string is like the Where condition of a query but without the word "where" in it (i.e., strWhereCondition = "MyField = " & Me.SubformControl.Form!ControlName). The report will open with only the specified record or records in its recordset.

    I'm assuming here that the button that opens the report is on the parent form, not the subform.
    Charlotte

Posting Permissions

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