compare a record to that on a continuous form

Pyro

Too busy to comment
Local time
Today, 23:10
Joined
Apr 2, 2009
Messages
127
Hi, i am trying to validate if a value exists on a continuous form from a main form. I have tried:

Code:
Private Sub txtin_use_AfterUpdate()
If Not IsNull(Me.txtin_use) Then
    If Me.cboprodname.Value = Me.sfrm_media_out_use.Form![product_id].Value Then
        MsgBox "There is atleast one batch of " & cboprodname.Column(1) & " currently listed as in use." & vbCrLf & _
        " " & vbCrLf & _
        "If this batch is no longer in use, update the record to reflect the finished date.", vbInformation, "Alert"
    End If
End If
End Sub

...which only checks the first record (as i thought it would). Has anyone got any ideas on how to get it to check all records?
 
Your sub form will be based on a query, I imagine, so instead of trying to interrogate the snapshot of records on the sub form go straight to the underlying query and check that. You will need to include the same criteria that exists between the master and child fields on the forms in your query.

David
 
That was the money DCrake, funnily enough i thought of that this morning when i got back to it. Sometimes you just need to take a break and clear your head to think straight...
 

Users who are viewing this thread

Back
Top Bottom