Form/Subform (Subform Combo Box w/Lookup Table)

If Not IsNull(Me.StudentID) Then Me.cboSelectStudent = Me.StudentID

If Me.cboSelectStudent & "" = "" Then
'stuff is visible
Else
'Stuff is not visible
End if

In the db I sent you, cboSelectStudent will never be null so the stuff will never be set to 'not visible'.

And incidentally, you could also just hide the tab control rather than all the subforms and controls on it individually.


You might be better off to use the form_open event to set all the 'stuff' not visible, then use the after_update event of the cboSelectStudent control to set the 'stuff' visible.
 
Awesome. I looked up and have the tab control's being hidden on form_open and being made visible on the cbo's onChange.

I also just noticed how you added in the name so that it's 100 times nicer looking than the conventional combo box drop-down. I do appreciate that, it's nice after a selection is made to have the entire name appear in the combo box.

How would I specify the combo box to not be populated with any name or StudentID onLoad?

I tried the following on the Sub Form_Open with no luck:
Code:
Me!cboSelectStudent.Value = ""
 
You can't set a value for a control in the on_load event until the on_current event occurs. Since on_load comes before on_current....you can't go there yet. You could try setting it in the on_current event but it might cause issues elsewhere. Try it and see.
 

Users who are viewing this thread

Back
Top Bottom