Update subform with combobox change on main form

Joined
Apr 23, 2013
Messages
1
Reaction score
0
I want to make a change to a subform based on the status of a combobox in the main form. Structure is like this:
main form: frmProductInfo
subform: frmProdLicenses
combobox on main form: cboPlatform.
The code is both on the Current event of the main form and the AfterUpdate event of the combobox:
Code:
Private Sub cboPlatform_AfterUpdate()
    If Me.Platform.Column(1) = "LDV Classic" Then
        [Forms]![frmProdLicenses]![RemoteWorkstation].Enabled = False
        Else: [Forms]![frmProdLicenses]![RemoteWorkstation].Enabled = True
    End If
End Sub
The code is supposed to enable certain properties of elements in the subform. When I make a change, I get an error message:
"Access cannot find the referenced form "frmProdLicenses".
The form name is correct and the form visible. I don't know where I'm going wrong...
This topic is cross-posted on the forum UtterAccess, but I didn't get any joy there...
 
Joined
Feb 20, 2010
Messages
12
Reaction score
0
It looks like you are not referring to all the forms in your code. You need to account for the main form:

[Forms]![frmProductInfo]![frmProdLicenses]![RemoteWorkstation].enabled

You should also be able to use this syntax:

Me.frmProdLicenses.form!RemoteWorkstation.enabled

which is referring to the subform collection directly.
 

Ask a Question

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.

Ask a Question

Top