G
Guest
I have a form based on a select query using two tables. There are three
field in each table that must match or else I would like to send the user a
message. I am confussed on the sql part.
Private Sub Form_Load(Cancel As Integer)
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim lngRecords As Long
Set db = CurrentDb
Set rst = db.OpenRecordset("SELECT ALLPolicies.CustomerNo,
ALLPolicies.Name, ALLPolicies.Carrier, ALLPolicies.EffDate,
ALLPolicies.AnnualPremium, ALLPolicies.PolicyNo, ALLPolicies.Agent
FROM WorkTable INNER JOIN ALLPolicies ON (WorkTable.CustomerNo =
ALLPolicies.CustomerNo) AND (WorkTable.ApplicationNo =
ALLPolicies.ApplicationNo) AND (WorkTable.Carrier = ALLPolicies.Carrier);
lngRecords = rst.Fields
If lngRecords = 0 Then
MsgBox "No records for this customer; application; carrier exist, please
try again!."
End If
End Sub
How can I use the count on the sql stmt???
field in each table that must match or else I would like to send the user a
message. I am confussed on the sql part.
Private Sub Form_Load(Cancel As Integer)
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim lngRecords As Long
Set db = CurrentDb
Set rst = db.OpenRecordset("SELECT ALLPolicies.CustomerNo,
ALLPolicies.Name, ALLPolicies.Carrier, ALLPolicies.EffDate,
ALLPolicies.AnnualPremium, ALLPolicies.PolicyNo, ALLPolicies.Agent
FROM WorkTable INNER JOIN ALLPolicies ON (WorkTable.CustomerNo =
ALLPolicies.CustomerNo) AND (WorkTable.ApplicationNo =
ALLPolicies.ApplicationNo) AND (WorkTable.Carrier = ALLPolicies.Carrier);
lngRecords = rst.Fields
If lngRecords = 0 Then
MsgBox "No records for this customer; application; carrier exist, please
try again!."
End If
End Sub
How can I use the count on the sql stmt???