The easiest way is (for new records) disable the subform by default until
the combo box selection is made. First select the subform, and in the
property sheet, disable it. Then:
Sub Form_Current()
If Me.NewRecord = False Then
Me.SubformControlName.Enabled = True
Else
Me.SubformControlName.Enabled = False
End If
End Sub
Sub MyCombo_AfterUpdate()
If Me.MyCombo <> "" Then
Me.SubformControlName.Enabled = True
End If
End Sub
Thx for the response, but I'm not sure this will work. The combo is in a tab
control on the main form. I'm trying to prevent people from using a subform
if no selection has been made to the combo on the main form.
Your after update event for the combo on the main form does not reference
the field(s) in the subform. I get an error. Can I do something like -
instead of Me.Field, Forms![Subform].[SubformField]? I'll try it...
I also want to make sure people can make changes to the subform anytime so
long as a selection to the combo has been made on the main form. Which means,
it will not always be a new record. Will this work if the user goes back to
this record after creating it to make a change or add a record to the subform?
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.