Thanks for the help. My macro looks like this:
Private Sub Go_to_Matching_Scoring_Click()
On Error GoTo Err_Go_to_Matching_Scoring_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Scoring Detail - All"
stLinkCriteria = "[PE ID]=" & Me![PE ID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Go_to_Matching_Scoring_Click:
Exit Sub
Err_Go_to_Matching_Scoring_Click:
MsgBox Err.Description
Resume Exit_Go_to_Matching_Scoring_Click
End Sub
Right now, it works great, unles there's no matching record. When that
happens it comes up with the debug error and I want it to pop up a form
saying "There's no matching record"
Steve Schapel said:
Eleanor,
If you're using a macro, you can use a Condition in the macro design.
In the Condition of the OpenForm action, something like this...
DCount("*","YourTable","[fldName]=whatever")>0
In the Condition of the MsgBox action, something like this...
DCount("*","YourTable","[fldName]=whatever")=0
Sorry, can't be more specific... it is not clear what you want to
"match" to.
--
Steve Schapel, Microsoft Access MVP
Eleanor of Aquitaine wrote:
I've created a command button with a macro attached that opens a new form and
looks for a matching record. If there's no match, I want to have a pop up
box saying "There's no match" and some options. I've created a Pop-up Form,
but need to know the code for: "if there's no match, display this pop-up".
fldName = [tName.fldName], if no match....
Can anyone help?