I am trying to pass a variable to a parameter. I have a form that has a button in it. When I click that button, I have it opening a report. When that report opens, it prompts for a name. I want to automatically send a name to that parameter so that the user wont have to input the name. When the report opens, it asks for Forms!frmSearch!cmbCoach, which is just a combo box that I made that has a list of people in it and when you input a name, it searches my database and displays information concerning that person. Basically, I have a login screen that asks for ID and Name. txtIDNum points to the Name box. I want to pass that Name to the report parameter so the user doesnt enter the name. I've looked at examples and I'm not really understanding the Me.variable syntax. Any help would be much appreciated. Thank you in advance.
Code:
Private Sub Command16_Click()
txtIDNum = Forms![LoginForm2]![Text13]
If Len(txtIDNum > 0) Then
DoCmd.OpenReport "rptDiscussionLogbyCoach", acViewReport, , , , txtIDNum
Else
MsgBox "Please enter your name"
Exit Sub
End If
End Sub