1
votes

I'm trying to create a button on a form that will open a report with just the current record.

I've done the following:

  • created a button
  • created Event Procedure for On Click (it opens macro mode instead of Visual Basic)
  • modified the Where Condition with various entries

Since the settings are in macro mode, I'm not sure how to post the macro code, so I'll enter it as a list.

  • OpenReport
  • Report Name: Awards by Category - Single
  • View: Print Preview
  • Filter Name: blank
  • Where Condition = [Registrants]![EventName]=[Me].[EventName]
  • Window Mode: blank

Expected results - clicking on button opens report showing just the current record

Actual results - clicking on button opens Enter Parameter Value dialog box asking to enter value for Me.EventName. When I enter current EventName, the report opens with the correct record showing.

1

1 Answers

1
votes

I would suggest changing the Where Condition of your macro to:

[Registrants]![EventName]=[Forms]![YourFormName]![EventName]

(Changing YourFormName to the name of your form)

Your current macro fails because Me is a VBA keyword (which refers to an instance of the class in which the current code is executing) and is therefore not applicable in this context.