Frustrated SubForms Cascading Fileds

T

tomrector

I have been working for a while on a subform and cascading fields .
The cascade will work when the subform(Work) is open by itself.

The following code is in AfterUpdate of the cascading field
(PartsUsed1) that the data relates to.

Private Sub PartsUsed1_AfterUpdate()
Forms!Work![PartsSell1].Requery
End Sub

When the subform (Work) is open in the MainForm the casade doesn't
allow 'requery' giving the following error,

Access can't find the Form 'Work' referred to in the Visual Basci
code.

How do I specify the form 'Work' in the code so that Access will
recognize it.


Thanks for any help that you may direct my way !
 
T

tomrector

Tony,
Didn't work, I get the message below, as well it look for the
PartsSell1 field (in the sub form) as the main form opens. My main form
name is "Vehicle"
I changed the AfterUpdate text to:

Private Sub PartsUsed1_AfterUpdate()
Forms!Vehicle!Work.[PartsSell1].Requery
End Sub

The error message I get "object doesn't support this property or
method".


Hi tomrector,

provided the subform is only ever going to be used as a subform refer to it
as;

Forms!MainFormName!Work.[PartsSell1]

where MainFormName is the name of the form that the subform resides.

TonyT..

I have been working for a while on a subform and cascading fields .
The cascade will work when the subform(Work) is open by itself.

The following code is in AfterUpdate of the cascading field
(PartsUsed1) that the data relates to.

Private Sub PartsUsed1_AfterUpdate()
Forms!Work![PartsSell1].Requery
End Sub

When the subform (Work) is open in the MainForm the casade doesn't
allow 'requery' giving the following error,

Access can't find the Form 'Work' referred to in the Visual Basci
code.

How do I specify the form 'Work' in the code so that Access will
recognize it.


Thanks for any help that you may direct my way !
 
T

TonyT

Hi again tom,


Tony,
Didn't work, I get the message below, as well it look for the
PartsSell1 field (in the sub form) as the main form opens. My main form
name is "Vehicle"

What is the control source for PartSell1? And is their any code on the
subforms OnCurrent event? These can trigger the AfterUpdate event of the
subform during load up.
I changed the AfterUpdate text to:

Private Sub PartsUsed1_AfterUpdate()
Forms!Vehicle!Work.[PartsSell1].Requery
End Sub

The error message I get "object doesn't support this property or
method".

Sorry, my mistake, got my syntax wrong :/

Forms!Vehicle!Work!Form.[PartSell1].Requery

left out the last Form, oops.

TonyT..
Hi tomrector,

provided the subform is only ever going to be used as a subform refer to it
as;

Forms!MainFormName!Work.[PartsSell1]

where MainFormName is the name of the form that the subform resides.

TonyT..

I have been working for a while on a subform and cascading fields .
The cascade will work when the subform(Work) is open by itself.

The following code is in AfterUpdate of the cascading field
(PartsUsed1) that the data relates to.

Private Sub PartsUsed1_AfterUpdate()
Forms!Work![PartsSell1].Requery
End Sub

When the subform (Work) is open in the MainForm the casade doesn't
allow 'requery' giving the following error,

Access can't find the Form 'Work' referred to in the Visual Basci
code.

How do I specify the form 'Work' in the code so that Access will
recognize it.


Thanks for any help that you may direct my way !
 
T

tomrector

Tony ,
Didn't work again, but kept trying, proper syntax was
Forms!Vehicle!Work.Form.[PartsSell1].Requery

Changed the "!" after "Work" to a "." , working find now.
Thanks for your help !

Tom
Hi again tom,


Tony,
Didn't work, I get the message below, as well it look for the
PartsSell1 field (in the sub form) as the main form opens. My main form
name is "Vehicle"

What is the control source for PartSell1? And is their any code on the
subforms OnCurrent event? These can trigger the AfterUpdate event of the
subform during load up.
I changed the AfterUpdate text to:

Private Sub PartsUsed1_AfterUpdate()
Forms!Vehicle!Work.[PartsSell1].Requery
End Sub

The error message I get "object doesn't support this property or
method".

Sorry, my mistake, got my syntax wrong :/

Forms!Vehicle!Work!Form.[PartSell1].Requery

left out the last Form, oops.

TonyT..
Hi tomrector,

provided the subform is only ever going to be used as a subform refer to it
as;

Forms!MainFormName!Work.[PartsSell1]

where MainFormName is the name of the form that the subform resides.

TonyT..

:

I have been working for a while on a subform and cascading fields .
The cascade will work when the subform(Work) is open by itself.

The following code is in AfterUpdate of the cascading field
(PartsUsed1) that the data relates to.

Private Sub PartsUsed1_AfterUpdate()
Forms!Work![PartsSell1].Requery
End Sub

When the subform (Work) is open in the MainForm the casade doesn't
allow 'requery' giving the following error,

Access can't find the Form 'Work' referred to in the Visual Basci
code.

How do I specify the form 'Work' in the code so that Access will
recognize it.


Thanks for any help that you may direct my way !
 
T

TonyT

bit like the blind leading the blind round here sometimes!!!!
fingers getting ahead of my brain on the keyboard again!
well done for getting there in the end despite my best efforts at diversion
tactics :p

TonyT..

Tony ,
Didn't work again, but kept trying, proper syntax was
Forms!Vehicle!Work.Form.[PartsSell1].Requery

Changed the "!" after "Work" to a "." , working find now.
Thanks for your help !

Tom
Hi again tom,


Tony,
Didn't work, I get the message below, as well it look for the
PartsSell1 field (in the sub form) as the main form opens. My main form
name is "Vehicle"

What is the control source for PartSell1? And is their any code on the
subforms OnCurrent event? These can trigger the AfterUpdate event of the
subform during load up.
I changed the AfterUpdate text to:

Private Sub PartsUsed1_AfterUpdate()
Forms!Vehicle!Work.[PartsSell1].Requery
End Sub

The error message I get "object doesn't support this property or
method".

Sorry, my mistake, got my syntax wrong :/

Forms!Vehicle!Work!Form.[PartSell1].Requery

left out the last Form, oops.

TonyT..
TonyT wrote:
Hi tomrector,

provided the subform is only ever going to be used as a subform refer to it
as;

Forms!MainFormName!Work.[PartsSell1]

where MainFormName is the name of the form that the subform resides.

TonyT..

:

I have been working for a while on a subform and cascading fields .
The cascade will work when the subform(Work) is open by itself.

The following code is in AfterUpdate of the cascading field
(PartsUsed1) that the data relates to.

Private Sub PartsUsed1_AfterUpdate()
Forms!Work![PartsSell1].Requery
End Sub

When the subform (Work) is open in the MainForm the casade doesn't
allow 'requery' giving the following error,

Access can't find the Form 'Work' referred to in the Visual Basci
code.

How do I specify the form 'Work' in the code so that Access will
recognize it.


Thanks for any help that you may direct my way !
 

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