Run-time error 40036

M

Mrs Pomemboo

Hello all,

First, sorry for my poor English, this is my last call to resolve my
problems and I most efficient in French.

In Access 97, I'm using a procedure that lock or unlock all controls
found in the main form who calls it. That main form could contain one or
many subforms which they could contains a subform also.

Here a resume of my procedure...
***********
Public Sub VerrouillerEnregistrement(frmFormulaire As Form)
Dim ctl1 As Control, Dim ctl2 As Control, Dim ctl3 As Control

For Each ctl1 In frmFormulaire.Controls
Select Case ctl1.ControlType
Case acSubform
'the next line is the place where I got the error
For Each ctl2 In ct1.Form.Controls
Select Case ctl2.ControlType
Case acSubform
For Each ctl3 In ctl2.Form.Controls
Select Case ctl3.ControlType
Case here...
End Select
Next ctl3
End Select
Next ctl2
End Select
Next ctl1
End Sub
*******************

The form where a I got the error contains 2 subforms. For the first one,
anything is fine, no error returned. But for the second one, I got an
error message : "Erreur d'execution 40036: La méthode SetFocus de
l'objet _SubForm a échouée " which if I translate should means "Run time
error 40036 : The SetFocus method on the _Subform objet has fail"...

So, I try to replace my line with "For Each ctl2 In
frmFormulaire.Controls(ctl1.Name).Form.Controls", but still got an
error, a diffirent one this time... "Error 40036 Application or Object
defined error"...

The question is... why it works on one subform and not for the other
ones. In the problematic subform, I'm not using any locked propreties or
kind of, no particular events, nothing that could be different than
other subforms present.

I'm very mixed up right now...any ideas or tips regarding problem should
be very appreciated !

Have a good day !

Mrs Pomemboo (Québec, Canada)
 
M

Mrs Pomemboo

For those interested... I found the problem !

An error in the variables declaration on the subform concerned was
returned on the Load events...

Mrs Pomemboo wrote:
|| Hello all,
||
|| First, sorry for my poor English, this is my last call to resolve my
|| problems and I most efficient in French.
||
|| In Access 97, I'm using a procedure that lock or unlock all controls
|| found in the main form who calls it. That main form could contain
|| one or many subforms which they could contains a subform also.
||
|| Here a resume of my procedure...
|| ***********
|| Public Sub VerrouillerEnregistrement(frmFormulaire As Form)
|| Dim ctl1 As Control, Dim ctl2 As Control, Dim ctl3 As Control
||
|| For Each ctl1 In frmFormulaire.Controls
|| Select Case ctl1.ControlType
|| Case acSubform
|| 'the next line is the place where I got the error
|| For Each ctl2 In ct1.Form.Controls
|| Select Case ctl2.ControlType
|| Case acSubform
|| For Each ctl3 In ctl2.Form.Controls
|| Select Case ctl3.ControlType
|| Case here...
|| End Select
|| Next ctl3
|| End Select
|| Next ctl2
|| End Select
|| Next ctl1
|| End Sub
|| *******************
||
|| The form where a I got the error contains 2 subforms. For the first
|| one, anything is fine, no error returned. But for the second one, I
|| got an error message : "Erreur d'execution 40036: La méthode
|| SetFocus de l'objet _SubForm a échouée " which if I translate should
|| means "Run time error 40036 : The SetFocus method on the _Subform
|| objet has fail"...
||
|| So, I try to replace my line with "For Each ctl2 In
|| frmFormulaire.Controls(ctl1.Name).Form.Controls", but still got an
|| error, a diffirent one this time... "Error 40036 Application or
|| Object defined error"...
||
|| The question is... why it works on one subform and not for the other
|| ones. In the problematic subform, I'm not using any locked
|| propreties or kind of, no particular events, nothing that could be
|| different than other subforms present.
||
|| I'm very mixed up right now...any ideas or tips regarding problem
|| should be very appreciated !
||
|| Have a good day !
||
|| Mrs Pomemboo (Québec, Canada)
 

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