I created a button that pulls up a specific record in a form:
Private Sub OpenExistingAuthor_Click()
On Error GoTo Err_OpenExistingAuthor_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "ManscriptTitleForm"
stLinkCriteria = "[LeadAuthor]=" & "'" & Me![Combo5] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_OpenExistingAuthor_Click:
Exit Sub
Err_OpenExistingAuthor_Click:
MsgBox Err.Description
Resume Exit_OpenExistingAuthor_Click
End Sub
And a button that pulls ALL records into the report:On Error GoTo Err_OpenExistingAuthor_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "ManscriptTitleForm"
stLinkCriteria = "[LeadAuthor]=" & "'" & Me![Combo5] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_OpenExistingAuthor_Click:
Exit Sub
Err_OpenExistingAuthor_Click:
MsgBox Err.Description
Resume Exit_OpenExistingAuthor_Click
End Sub
Private Sub AllLeadAuthorsReport_Click()
On Error GoTo Err_AllLeadAuthorsReport_Click
Dim stDocName As String
stDocName = "ManscriptReport"
DoCmd.OpenReport stDocName, acViewReport
Exit_AllLeadAuthorsReport_Click:
Exit Sub
Err_AllLeadAuthorsReport_Click:
MsgBox Err.Description
Resume Exit_AllLeadAuthorsReport_Click
End Sub
Now what I need is a button that pulls a specific record for the report. I tried adapting the stLinkCriteria in the form code to try to get it to work in the report code but no such luck. Any suggestions????On Error GoTo Err_AllLeadAuthorsReport_Click
Dim stDocName As String
stDocName = "ManscriptReport"
DoCmd.OpenReport stDocName, acViewReport
Exit_AllLeadAuthorsReport_Click:
Exit Sub
Err_AllLeadAuthorsReport_Click:
MsgBox Err.Description
Resume Exit_AllLeadAuthorsReport_Click
End Sub