Subforms Visable/Invisable

K

katelin0429

I am making a form to enter electronic pmt information. I have a main table
w/ userID and type, and both of those fields are dropdowns created from look
up tables. The main form is from that table. I have a seperate table/form for
each type of elctronic pmt, which is a subform on the main form. I want the
form to open up with just the userid and type showing (main table), and when
the type is selected the form for the type to appear. I've tried everything I
can think of, and it's not working. Can someone tell me the best way to do
this? I using Access 2003. Thanks
 
C

Carl Rapson

Did you try this?

1. In Form_Load, set the Visible property of your subform control to False.

2. In the AfterUpdate event of the type combo box, set the Visible property
of the subform control to True.

If you did and it didn't work, what else have you tried?

Carl Rapson
 
K

katelin0429

I've tried that but I can't get it to work. I'm sure it's something wrong
with the code, but I can't figure it out. This is what I did. It keeps saying
object doesn't support this property or method. Would I have to do else and
list visable = false for every other pmt type?

Private Sub BatchType_AfterUpdate()
If BatchType = "LOCKBOX" Then
Forms!frmelmain!frmellkbx.visable = True
End If

End Sub
 
K

katelin0429

I aslo tried this in the expression builder:
=IIf([BatchType]="LOCKBOX",frmellkbx.Form.Visible)
It doesn't give an error, but the subform doesn't appear.
 
C

Carl Rapson

In the first case, you misspelled "Visible" as "visable". Try that and see
if it works. In the second case, you aren't really doing anything with the
Visible property of the subform so no change takes place. It would need to
be something like:

=IIf([BatchType]="LOCKBOX",frmellkbx.Form.Visible = True)

Although I'm not certain that would work also. Your best bet is to go back
to your first method:

Private Sub BatchType_AfterUpdate()
If BatchType = "LOCKBOX" Then
Forms!frmelmain!frmellkbx.Visible = True
End If
End Sub

Carl Rapson

katelin0429 said:
I aslo tried this in the expression builder:
=IIf([BatchType]="LOCKBOX",frmellkbx.Form.Visible)
It doesn't give an error, but the subform doesn't appear.

katelin0429 said:
I've tried that but I can't get it to work. I'm sure it's something wrong
with the code, but I can't figure it out. This is what I did. It keeps
saying
object doesn't support this property or method. Would I have to do else
and
list visable = false for every other pmt type?

Private Sub BatchType_AfterUpdate()
If BatchType = "LOCKBOX" Then
Forms!frmelmain!frmellkbx.visable = True
End If

End Sub
 
K

katelin0429

Oh geez... I knew it would be something totally stupid:) That worked. Thanks
so much!!
 
Top