I have to search for an account that is made up of a letter and then numbers. I want the user to be able to search without the letter. Ihave used the following code:
Private Sub cmdAccountSearch_Click()
On Error GoTo Err_cmdAccountSearch_Click
strAccountNo = Me.AccountNo
If (DCount("AccountNo", "tblAccountBase", "AccountNo LIKE '*" & strAccountNo & "'")) = 0 Then
MsgBox "The Account Number you are searching for is not in the database!"
Me.AccountNo = ""
Me.AccountNo.SetFocus
Else
DoCmd.OpenForm "frmUpdateAccount", acNormal, , "AccountNo = '" & strAccountNo & "'"
DoCmd.Close acForm, "frmAccountSearch", acSaveNo
End If
Exit_cmdAccountSearch_Click:
Exit Sub
Err_cmdAccountSearch_Click:
MsgBox Err.Description
Resume Exit_cmdAccountSearch_Click
End Sub
It opens the form but the record is blank.
Anybody got any ideas.
Thanks
Private Sub cmdAccountSearch_Click()
On Error GoTo Err_cmdAccountSearch_Click
strAccountNo = Me.AccountNo
If (DCount("AccountNo", "tblAccountBase", "AccountNo LIKE '*" & strAccountNo & "'")) = 0 Then
MsgBox "The Account Number you are searching for is not in the database!"
Me.AccountNo = ""
Me.AccountNo.SetFocus
Else
DoCmd.OpenForm "frmUpdateAccount", acNormal, , "AccountNo = '" & strAccountNo & "'"
DoCmd.Close acForm, "frmAccountSearch", acSaveNo
End If
Exit_cmdAccountSearch_Click:
Exit Sub
Err_cmdAccountSearch_Click:
MsgBox Err.Description
Resume Exit_cmdAccountSearch_Click
End Sub
It opens the form but the record is blank.
Anybody got any ideas.
Thanks