Results 1 to 2 of 2
  1. #1
    2 Star Lounger
    Join Date
    Feb 2003
    Thanked 0 Times in 0 Posts
    I need help designing a form that will be used to define filter criteria for a report.

    I'd like to have a main form with a subform in datasheet view. The user would use filter by form (subform) to select the data they'd like to see in the report. I'd have a button on the main form that allows the user to generate a report displaying the filtered data selected in the datasheet subform.

    Can I get to the datasheet subform's recordsource and filter (set by filter by form) as a string in VBA? I was thinking if I can get to the SQL strings, I could store them in a public variable and pass it to the report during the On Open event. I'm sure there's a standard way of doing such a thing, just can't seem to find an example.

    Any help would be greatly appreciated...

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 31 Times in 31 Posts
    RecordSource and Filter are both string properties of a form.
    You can use the OpenArgs argument of DoCmd.OpenReport to pass a string to the report that can be used in the On Open event of the report: Me.OpenArgs will contain the string.

Posting Permissions

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