Access OpenArgs in Access 2010 failing

Joined
Mar 2, 2015
Messages
1
Reaction score
0
I am using Access 2010 (for the first time) and finding that OpenArgs does not work with reports. When I start typing DoCmd.OpenReport Intellisense prompts for OpenArgs (which suggests it ought to work). If I then attach code to the Load event of the form (I try to set the OpenArgs value as the value in a text field) I get error 2185 'You can't reference a property or method for a control unless the control has focus'. If I try to give the control focus I get Runtime Error 2950 'Reserved Error'. The code is very simple and I have used it many times before with earlier versions of Access,

Private Sub Report_Load()
If IsNull(OpenArgs) Then
Me.txtReportTitle.SetFocus
Me.txtReportTitle.Text = "No argument passed"
Else
Me.txtReportTitle.SetFocus
Me.txtReportTitle.Text = OpenArgs
End If
 
Back
Top