Sub or Function not defined?!

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
 
D

Dirk Goldgar

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.
 
G

Guest

Try

Form_SubFormName.UpdateFillsFormState (True)

Replace SubFormName with the form name
 
G

Guest

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
 

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