I have a database table which has Client Insurance policies. Each policy has the possibility of 2 ID'S (eg. husband and wife). To query this database I have a form with a list control for the Names, Policy Number, ID1, ID2 etc... and a subform which is a datasheet. When I query a policy, the subform datasheet displays all the policies with ID1's = to the selected ID1.
I want to also include on this datasheet all the policies with the this ID1 value in the ID2 position. I have tried the following code in the AfterUpdate event of the subform, with no result:
Private Sub Form_AfterUpdate()
Dim C As Recordset
Set C = Screen.ActiveForm.RecordsetClone
CritText = "ID1 = " & Chr(34) & [ID2] & Chr(34)
C.Find CritText
If Not C.NoMatch Then
[FormNo] = C![FormNo]
[Cover1] = C![Cover1]
[Name2] = C![Name2]
[Cover1] = C![Cover1]
[Cover2] = C![Cover2]
[Company] = C![Company]
[Policy_No] = C![Policy_No]
[Start_Date] = C![Start_Date]
[Term] = C![Term]
[Class] = C![Class]
[Premium1] = C![Premium1]
[Premium2] = C![Premium2]
[ID1] = C![ID1]
[ID2] = C![ID2]
Else
DoCmd Requery
End If
End Sub
Does anyone have any ideas on how to get these secondary ID's onto the datasheet,
Thanks
Groengoen
I want to also include on this datasheet all the policies with the this ID1 value in the ID2 position. I have tried the following code in the AfterUpdate event of the subform, with no result:
Private Sub Form_AfterUpdate()
Dim C As Recordset
Set C = Screen.ActiveForm.RecordsetClone
CritText = "ID1 = " & Chr(34) & [ID2] & Chr(34)
C.Find CritText
If Not C.NoMatch Then
[FormNo] = C![FormNo]
[Cover1] = C![Cover1]
[Name2] = C![Name2]
[Cover1] = C![Cover1]
[Cover2] = C![Cover2]
[Company] = C![Company]
[Policy_No] = C![Policy_No]
[Start_Date] = C![Start_Date]
[Term] = C![Term]
[Class] = C![Class]
[Premium1] = C![Premium1]
[Premium2] = C![Premium2]
[ID1] = C![ID1]
[ID2] = C![ID2]
Else
DoCmd Requery
End If
End Sub
Does anyone have any ideas on how to get these secondary ID's onto the datasheet,
Thanks
Groengoen