I need and appreciate your help.
Running this program I get the error message:
MS office cannot find the field ... referred to in your expression.
Highlight stands on the red line.
I have a table :TblePeople , a form with a textbox which gets TenantSSN. if it exists in the table, a massage says: This Person Already exists! and three other textboxs are supposed to get the Name, Phone number and date of birth out of the TblePeople .
otherwise nothing happens and the user will fill the three boxes.
Private Sub SSNumber_Exit(Cancel As Integer)
Dim dbs As DAO.Database
Dim rstRecordTrans As DAO.Recordset
Set dbs = CurrentDb
Set rstRecordTrans = dbs.OpenRecordset("TblePeople")
Dim PName As String
Dim PDOB As Date
Dim PPhone As Integer
Me.[SSN] = Me.[SSNumber]
If DCount("*", "TblePeople", "SSN='" & Me.TenantSSN & "' ") > 0 Then MsgBox "This Person Already exists!", vbExclamation
PName = [TblePeople]![FullName].Value
PDOB = [TblePeople]![PhoneNumber].Value
PPhone = [TblePeople]![DOB].Value
Me.TenantName = PName
Me.TenantPhone = PDOB
Me.TenantDOB = PPhone
rstRecordTrans.Close
End Sub
Running this program I get the error message:
MS office cannot find the field ... referred to in your expression.
Highlight stands on the red line.
I have a table :TblePeople , a form with a textbox which gets TenantSSN. if it exists in the table, a massage says: This Person Already exists! and three other textboxs are supposed to get the Name, Phone number and date of birth out of the TblePeople .
otherwise nothing happens and the user will fill the three boxes.
Private Sub SSNumber_Exit(Cancel As Integer)
Dim dbs As DAO.Database
Dim rstRecordTrans As DAO.Recordset
Set dbs = CurrentDb
Set rstRecordTrans = dbs.OpenRecordset("TblePeople")
Dim PName As String
Dim PDOB As Date
Dim PPhone As Integer
Me.[SSN] = Me.[SSNumber]
If DCount("*", "TblePeople", "SSN='" & Me.TenantSSN & "' ") > 0 Then MsgBox "This Person Already exists!", vbExclamation
PName = [TblePeople]![FullName].Value
PDOB = [TblePeople]![PhoneNumber].Value
PPhone = [TblePeople]![DOB].Value
Me.TenantName = PName
Me.TenantPhone = PDOB
Me.TenantDOB = PPhone
rstRecordTrans.Close
End Sub