Sub or Function not defined?!

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

In a further attempt to debug the disabled=false problem, I wrote out some
enabling code in the subforms and call it from the parent. Here is the code
in the subform...

Public Sub UpdateFillsFormState(canEdit)
QuantityField.Enabled = canEdit
PriceField.Enabled = canEdit
TaxField.Enabled = canEdit
NetField.Enabled = canEdit

If Me.RecordsetClone.recordCount > 0 And QuantityField.Enabled = True
Then QuantityField.SetFocus
End Sub

Over in the main form I wait until I know the form is loaded and set up
properly, then I do this...

Public Sub SetupFillState()
canEdit = isEditable()
Call UpdateFillsFormState(canEdit)
End Sub

Access complains that UpdateFillsFormState doesn't exist. Normally this
implies I forgot to set it to public, but as you can see, this is not the
problem. isEditable is definitely returning True.

Any ideas? Is this a "duh"?

Maury
 
In
Maury Markowitz said:
In a further attempt to debug the disabled=false problem, I wrote out
some enabling code in the subforms and call it from the parent. Here
is the code in the subform...

Public Sub UpdateFillsFormState(canEdit)
QuantityField.Enabled = canEdit
PriceField.Enabled = canEdit
TaxField.Enabled = canEdit
NetField.Enabled = canEdit

If Me.RecordsetClone.recordCount > 0 And QuantityField.Enabled = True
Then QuantityField.SetFocus
End Sub

Over in the main form I wait until I know the form is loaded and set
up properly, then I do this...

Public Sub SetupFillState()
canEdit = isEditable()
Call UpdateFillsFormState(canEdit)
End Sub

Access complains that UpdateFillsFormState doesn't exist. Normally
this implies I forgot to set it to public, but as you can see, this
is not the problem. isEditable is definitely returning True.

Any ideas? Is this a "duh"?

The Sub may be public, but since it's defined in a class module (the
subform's module), any call to it must be qualified with a reference to
the specific class instance. So, on the main form you'd write something
like this:

Call Me.YourSubformControlName.Form.UpdateFillsFormState(canEdit)

In the above, "YourSubformControlName" must be the name of the subform
control, on the main form, that is displaying the subform.
 
Dirk Goldgar said:
Call Me.YourSubformControlName.Form.UpdateFillsFormState(canEdit)

I had actually tried this, the key was ".Form.". Working like a champ now,
and the enabling problems disappeared immediately.

Maury
 
Back
Top