Scaning values in a subform

JACKSON

Registered User.
Local time
Today, 20:24
Joined
Dec 22, 2003
Messages
79
Would anyone have any sample code to :

Check data values in a specific field in a continuous subform, and compare with a data value being entered into a field on the main form. As example if I had a main form with client info that allowed me to enter detail records, but I want to, on the Update event of a specific field, check the values in the subform for that client, and alert the user if one matches. I am not worried about referencing the subform properly etc.., but really just the code to scan the values in a subform and compare to the value I enter on a main form ?

Thanks
 
HI

I suppose the values being displayed in your continuous form are stored in a table. I think I would use the DCount function - something like this:

Private Sub txtMyValue_AfterUpdate()

If DCount("*", "MyTable", "[MyValue]=" & Me.txtMyValue) > 0 Then
MsgBox "Duplicate value."
End If

End Sub


hth

shay
 

Users who are viewing this thread

Back
Top Bottom