G
Guest
I have a dialog box that allows someone to search personnel records based on
an SSN. I've been testing with known SSNs and I'm running into an
interesting problem where sometimes the SSN has to have the dashes and at
other times it cannot have them for a successful query. I'm having the
results of this query open a form, based on whether or not a record is found,
and that part of my code is working. Any ideas on the SSN problem? I've
posted my code below:
Private Sub cmdSubmit_Click()
On Error GoTo Err_cmdSubmit_Click
Dim stDocName As String
stDocName = "qryRecordSearch"
DoCmd.OpenQuery stDocName, acNormal, acReadOnly
If stDocName <> "" Then
stLinkCriteria = "[SocialSecurity#]=" & "'" & Me![Text0] & "'"
DoCmd.OpenForm "frmApplicants", , , stLinkCriteria
Else
DoCmd.OpenForm "frmApplicantsNew", acNormal, acReadOnly
End If
DoCmd.Close acQuery, stDocName
DoCmd.Close acForm, "frmRecordQuery"
Exit_cmdSubmit_Click:
Exit Sub
Err_cmdSubmit_Click:
MsgBox Err.Description
Resume Exit_cmdSubmit_Click
End Sub
an SSN. I've been testing with known SSNs and I'm running into an
interesting problem where sometimes the SSN has to have the dashes and at
other times it cannot have them for a successful query. I'm having the
results of this query open a form, based on whether or not a record is found,
and that part of my code is working. Any ideas on the SSN problem? I've
posted my code below:
Private Sub cmdSubmit_Click()
On Error GoTo Err_cmdSubmit_Click
Dim stDocName As String
stDocName = "qryRecordSearch"
DoCmd.OpenQuery stDocName, acNormal, acReadOnly
If stDocName <> "" Then
stLinkCriteria = "[SocialSecurity#]=" & "'" & Me![Text0] & "'"
DoCmd.OpenForm "frmApplicants", , , stLinkCriteria
Else
DoCmd.OpenForm "frmApplicantsNew", acNormal, acReadOnly
End If
DoCmd.Close acQuery, stDocName
DoCmd.Close acForm, "frmRecordQuery"
Exit_cmdSubmit_Click:
Exit Sub
Err_cmdSubmit_Click:
MsgBox Err.Description
Resume Exit_cmdSubmit_Click
End Sub