Hi All,
I am having the most vexing of problems. My code is executing inconsistently. I have a form I am designed for record audits. It randomly selects individuals and returns counts for various types of records associated with the individual. I am trying to pass arguments to a set of reports, restricting their recordsets to records for a particular individual. In all cases I am using an ID number as an OpenArgs argument and passing it in using the same code. However, when i step through code execution I find something rather perplexing. In some reports, when the code execution moves from the Form object to the individual record object, the Me.OpenArgs value is shown as null despite the fact that the ID variable passed in had a value at the time the DoCmd.OpenReport action was executed. The most frustrating thing about this is, it works with some reports using the exact same code. I would appreciate any insights anyone might have.
Some code snippets are below:
Code:
Private Sub btnInt1_Click() '<- This one works just fine and the ID value passes effectively to the "Internship-RT SS" report
Dim ID As String
ID = Me.ID1
DoCmd.OpenReport "Internship-RT SS", acViewReport, , , , ID
End Sub
Private Sub btnEmp1_Click() '<- This ID value won't effectively pass to the "rptEmp" report, despite ID having a real value when the DoCmd.OpenReport method is called
Dim ID As String
ID = Me.ID1
DoCmd.OpenReport "rptEmp", acViewReport, , , , ID
End Sub
And before you ask why I created an ID variable that I pass to the OpenArgs property rather than just using the Me.ID1 reference, the "Internship-RT SS" report didn't open properly until I did that. Anyway, if anyone has had experience trouble shooting this type of error I would love some suggestions.
Thanks!
Ryan