Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
We've got phone software that, when the call comes in, it's dumped into a variable called remoteNumber. My VB code checks the number against what I have in my access database, and if it exists, my form pops up (6000 records) with the correct customer data of that caller. The field on the form that I need to compare is ContactMainPhone.
' // Apply filter to display all records that match our criteria...
oAccess.DoCmd.ApplyFilter , (MM_DB_TBLE_COL + "=" + chr(WVrCall.RemoteNumber))
Private Sub cmdCheckPhoneNumber_Click()
On Error GoTo ErrHandler
Dim sPhoneNumber As String
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strSql As String
Set db = CurrentDb
strSql = "SELECT COUNT(1) FROM CustServicePopup WHERE ContactMainPhone = '"
'Check to make sure we have a number
txtContactMainPhone.SetFocus
If txtContactMainPhone.Text = "" Then
MsgBox "No phone number to check!", vbOKOnly, "Attention"
Exit Sub
Else
sPhoneNumber = Trim(txtContactMainPhone.Text)
End If
Set db = CurrentDb
strSql = "SELECT COUNT(*)AS [RecCount] FROM CustServicePopup WHERE ContactMainPhone = '" & sPhoneNumber & "'"
Set rs = db.OpenRecordset(strSql, dbOpenForwardOnly)
If rs.Fields("RecCount").Value = 0 Then
MsgBox "No records found", vbOKOnly, "Attention"
Else
MsgBox rs.Fields("RecCount").Value & " Records found", vbOKOnly, "Record exist"
End If
Set rs = Nothing
Set db = Nothing
Exit Sub
ErrHandler:
MsgBox "Error checking phone number. Error #: " & Err.Number & ", " & Err.Description, vbOKOnly, "Error!"
Set rs = Nothing
Set db = Nothing
End Sub