Valadate data on form

Caddie

Registered User.
Local time
Yesterday, 16:38
Joined
Feb 16, 2010
Messages
75
Hi -

I have a main form with a subform which has a subform in it.

I'd like to make so a user cannot enter data into a child form without completing the parent form first. How would I go about doing this?

Thanks.
 
Hi -

I have a main form with a subform which has a subform in it.

I'd like to make so a user cannot enter data into a child form without completing the parent form first. How would I go about doing this?

Thanks.

Try locking the sub form until the parent form has been saved.
 
Sorry but, how do you do that?
 
On your subform set enabled = no using the form properties then using VBA somewhere through your parent form, use:

Me.objectname.Enabled = True
 
I would use the parent forms' On Current event like this:

Assuming the sub form contol's name is sfMySubForm

Code:
Private Sub Form_Current()

Me.sfMySubForm.Locked = Me.NewRecord

End Sub



or is Longhand code:

Code:
Private Sub Form_Current()

If Me.NewRecord = True Then 
   Me.sfMySubForm.Locked = True
Else
   Me.sfMySubForm.Locked = False
End If

End Sub

Use the Parent form's After update event like this:

Code:
Private Sub Form_AfterUpdate()
   Me.sfMySubForm.Locked = False

End Sub
 
This seems to work however it is messing with my tab orders for some reason. Any ideas why this would happen?
 
This seems to work however it is messing with my tab orders for some reason. Any ideas why this would happen?

Unless you are using code to set the focus or move to a control in the, it is using the default method.
 

Users who are viewing this thread

Back
Top Bottom