2 Subforms.. One Command... One Answer?

kirky007

Registered User.
Local time
Today, 12:54
Joined
Aug 22, 2005
Messages
24
Hiya,
I have a form that uses two subforms. The first subform allows users to enter timecard details and the other subform shows all the hours worked. I have a refresh button on the form so that when users click the button the timecard details from subform one are automatically shown on subform two and the user can then enter more details. However i want my refresh button to only work if a user has enter details in the first subform otherwise i get a load of blank entries in my second subform. Let's say that if hours dont equal zero then the form will refresh else nothing happens. I would be able to do this normally its just that the hours field is in the subform.

Please help.
Andy
 
You can reference a control of a subform from the main form (to check for a condition where value <> 0 for instance).

An example of a control reference on another form: Forms![Form1]![Control1]

So the code for the On_Click() event would be something like...

If IsNumeric(Forms![Form1]![Control1]) and (Forms![Form1]![Control1] > 0) Then
'<Perform update>
End If

Hope that helps...
 

Users who are viewing this thread

Back
Top Bottom