Hiding a subform until mainform has data entered

Rachael

Registered User.
Local time
Today, 07:31
Joined
Nov 2, 2000
Messages
205
I'm pretty new to all of this so my problem is probably pretty basic. I have a form with 2 subforms embedded on it. When a new record is entered I don't want the subforms to be visible until some data as been entered into the main form (so that the auto number is available) this seems the best way to stop data entry in the subforms first and causing 'Null'issues etc. Hope someone can help thanks.
 
I prefer to use an entry event on the subform something like
If IsNull(Me.YourTextBox) Then
Beep
MsgBox "STOP please enter data on main form before entering subform.", vbOKOnly, ""
SendKeys "{ESC}"
YourTextbox.SetFocus
 
Another method that might work for you is to put code in the On Current event of the Main Form. The code might look something like:

If Me.NewRecord Then
Me![Subform1].Visible = False
Me![Subform2].Visible = False
End If

Then in the After Update event of the first Text box on the Main Form you might have code like this:

Me![Subform1].Visible = True
Me![Subform2].Visible = True

HTH,
Jack
 
Thankyou very, very much. I'm on a very sharp learning curve and your help (and time) is very much appreciated. The form now works great!

Thanks Rachael
 

Users who are viewing this thread

Back
Top Bottom