Hiding Subform till data is entered into the Main Form

nobbie1

Registered User.
Local time
Today, 16:07
Joined
Aug 13, 2003
Messages
25
Hello everyone,

I've been searching through the forums here looking for a possible solution to my question.

I'd like to hide a subform until data is entered on my main form. Specifically from a combo box which lists the first and last names of the techs using the form.

I am trying to keep them from entering data in the subform before selecting their name on the main form.
 
Set the subform to not visible in design mode, so it starts hidden. In the after update event of the combobox:

Me.SubFormName.Visible = True
 
Ok, I'm able to set the subform to hidden with the On Load Event.

Now I'm having trouble getting the AfterUpdate Event to work to make the subform visible again. This is what I have in my AfterUpdate event code for my combobox:

Private Sub Combo10_AfterUpdate()
Dim rs As Object

' Find the record that matches the control and unhide Subform for data entry.

Set rs = Me.RecordsetClone
rs.FindFirst "[TechID] = " & (Me![Combo10])
Me.Bookmark = rs.Bookmark
Set rs = Nothing
Me.sfrmtechs.Visible = True

End Sub

My main form is called frmTechs and my subform is sfrmTechs

When I go to compile it, Access says Method or Data Member not found. Not sure where I went wrong.
 
If the compile error occurs on the subform visible line, the most likely problem is that "sfrmTechs" is not the name of the subform control within the main form (even though it's the name of the subform). When you typed "me." did that name come up, or did you have to type it all in?
 
Ah I see what happened now.

I had renamed my subform, but the control stayed as the orginal name I had.

Is there a way I can edit the subform controls?

Thanks for the lead on what drops down after I had typed in Me.

It's working now :)
 
You can change the name of the subform control in it's properties (while in design mode of the main form).
 

Users who are viewing this thread

Back
Top Bottom