ARGH !! Need help on Visible/Invisible subform

vangogh228

Registered User.
Local time
Today, 11:22
Joined
Apr 19, 2002
Messages
302
I am trying to make a subform appear when a particular entry is selected from a list box. I did a test... no problem. In my real database... well, you know. Here's my code:

----

On my main form property:

Private Sub Form_Open(Cancel As Integer)

DoCmd.Maximize
DoCmd.GoToRecord , , acNewRec

If Me![ProjectSubType] = "Commercial Chest" Then
Me![CommercialChestsSubForm].Visible = True
Else
Me![CommercialChestsSubForm].Visible = False
End If

End Sub


----
On my list box property:

Private Sub ProjectSubType_AfterUpdate()

If Me![ProjectSubType] = "Commercial Chest" Then
Me![CommercialChestsSubForm].Visible = True
Else
Me![CommercialChestsSubForm].Visible = False
End If

End Sub


----


Any help is GREATLY APPRECIATED.

Tom
 
I just had a revelation that since I have the form opening to a new record, I don't need the IF. Other than that, I can't figure this out. Thanks again!
 
Here's A Lesson ---

The list box I am using is bound to a table. As I wanted to be able to manipulate the order of the list, I used an Autonum field as the ORDER BY. However, I FORGOT to go into the list box property and set the BOUND column to "2" instead of "1". The value was being recorded as the autonum value, and my requirement of "Commercial Chest" was then impossible.

The simplest answers are usually the right ones.
 

Users who are viewing this thread

Back
Top Bottom