Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hiding subforms for new records 1

Status
Not open for further replies.

gemoon

Programmer
Mar 22, 2002
55
US
Im having trouble hiding forms. I have some two linked subforms. The two subforms, sfrmDate and sfrmCoreSize have one field each, Date and CoreSize, respectively. When a new record is added sfrmDate, I want to hide sfrmCoreSize until a date is entered. I want to do this to prevent someone from entering a core size before a date.

From what Ive read I need to use the on_current event in sfrmDate to set sfrmCoreSize.visibility to false when the date is null. However, with my "a little knowledge can be dangerous" vba skills Im not sure where to begin.

Along these lines can anyone suggest a good site with the basics of vba.

Many thanks in advance any advice.
Ed.
 
Hmm, what about using the Form_AfterUpdate or SomeControl_AfterUpdate event to do this.. so something like this:
Code:
Private Sub Form_AfterUpdate()
  If IsNull(Date) Then
     sfrmCoreSize.Visible = False
  Else
     sfrmCoreSize.Visible = True
  End If
End Sub

And in your Form_Load event, you could have it set to whatever you want the default, I'm guessing False.. like this:

Code:
Private Sub Form_Load()
  sfrmCoreSize.Visible = False
End Sub

I would think that would work...

Stephen [infinity]
"Jesus saith unto him, I am the way, the truth, and the life:
no man cometh unto the Father, but by me." John 14:6 KJV
 
Thanks,
I took your suggestion and modified it using something I found on another post.

Private Sub Date_GotFocus()
If (Me.NewRecord) Then
Me.Parent![sfrmCoreSize].Visible = False
Else
Me.Parent![sfrmCoreSize].Visible = True
End If
End Sub

Thanks again,
Ed.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top