You have to have the strLinkCriteria line BEFORE the DoCmd.OpenForm line!!!
You have
Code:
On Error GoTo Err_history_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmEventSubTwo"
DoCmd.OpenForm stDocName, , , stLinkCriteria
strCriteria = "[EventID] = " & Me![EventID]
Exit_history_Click:
Exit Sub
Err_history_Click:
MsgBox Err.Description
Resume Exit_history_Click
"stLinkCriteria" is empty when the open form command is executed.
It should be:
Code:
On Error GoTo Err_history_Click
Dim stDocName As String
Dim stLinkCriteria As String
stLinkCriteria= "[EventID] = " & Me![EventID] 'added "Link"as per ketbdnetbp :)
stDocName = "frmEventSubTwo"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_history_Click:
Exit Sub
Err_history_Click:
MsgBox Err.Description
Resume Exit_history_Click