Calling a public procedure on a subform (1 Viewer)

SmallTime

Registered User.
Local time
Today, 05:35
Joined
Mar 24, 2011
Messages
246
Hi,

I think I've been at the keyboard for far to long. :eek:

Could someone please show me the correct syntax for calling a public proc on a sub form

Code:
call Forms!FrmNewOrderConnected!FrmNewOrderItemsConnected.Form!itmQuantity.AfterUpdate()

I'm pretty sure I managed this in the distance past but can seem work it again.

Ta
 

RainLover

VIP From a land downunder
Local time
Today, 22:35
Joined
Jan 5, 2009
Messages
5,041
Try

Code:
Sub NameOfSub
 
NameOfPublicSub
 
End Sub

Mostly guess work as I have no idea what your Public is all about.
 

SmallTime

Registered User.
Local time
Today, 05:35
Joined
Mar 24, 2011
Messages
246
Hi RainLover

Thanks for the suggestion

Perhaps I haven't made my problem very clear

The Public Sub itmQuantity.AfterUpdate() is on a subform FrmNewOrderItemsConnected.
The parent form is FrmNewOrderConnected

I want to call itmQuantity.AfterUpdate() from an unrelated form say "Frm1"

I just can't seem to get the syntax that'll refer to itmQuantity.AfterUpdate(). Tried all sorts but I seem to be going around in circles

Cheers
 

SmallTime

Registered User.
Local time
Today, 05:35
Joined
Mar 24, 2011
Messages
246
Never mind - I gave-up, converted the the sub to a Public Function instead

Still would be nice to know how to do call a public sub on a subform

Thanks for your time
 

ChrisO

Registered User.
Local time
Today, 22:35
Joined
Apr 30, 2003
Messages
3,202
Public Sub itmQuantity.AfterUpdate()

Is an invalid name for a procedure so it can’t work no matter how you call it.

Chris.
 

SmallTime

Registered User.
Local time
Today, 05:35
Joined
Mar 24, 2011
Messages
246
ChrisO

You're absolutely right, my mistake I should have typed
itmQuantity_AfterUpdate()

But tried it out of interest, still no go.
 

ChrisO

Registered User.
Local time
Today, 22:35
Joined
Apr 30, 2003
Messages
3,202
>>my mistake I should have typed<<

No, you should not have typed at all, better to copy/paste code. Very few people can type code without error; it’s just a matter of time till they do.

In any case, given the names supplied:-

Forms("FrmNewOrderConnected").FrmNewOrderItemsConnected.Form.itmQuantity_AfterUpdate
(Remove the space from the above code; that’s just a site ‘feature’.)

It might also depend on the name of the sub-form Control which you have used.

Chris.
 

SmallTime

Registered User.
Local time
Today, 05:35
Joined
Mar 24, 2011
Messages
246
Thanks for the help

got this

run-time error 2465
Application-defined or object-defined error


Never mind, I've given up and gone another route.

Take care
 

ChrisO

Registered User.
Local time
Today, 22:35
Joined
Apr 30, 2003
Messages
3,202
You did say this in post #4
>>Still would be nice to know how to do call a public sub on a subform<<

Please don’t be so dismissive of those who are trying to help.
It takes time to reply and you either want to learn or you don’t.

Chris.
 

SmallTime

Registered User.
Local time
Today, 05:35
Joined
Mar 24, 2011
Messages
246
Firstly thank for the look-in and pointers, all appreciated.

I'm painfully aware that time is valuable and scarce. So please don't mistake my comments as being dismissive, it's just that there's no further point in spending time looking for solution for me in this instance when you might spend that time help someone else who might need it more, maybe even me again in another post!

Once again Many thanks, and please take that on face value without trying to read to much into it or making a mountain out of a molehill

Take care
 

ChrisO

Registered User.
Local time
Today, 22:35
Joined
Apr 30, 2003
Messages
3,202
SmallTime.

I understand your intention; you have your solution and, for you, there is no point in wasting more of my time. I appreciate your intention.

But please try to understand the intention of this site; the solution you sort may very well be the solution others seek.

It’s not just about you and me. I put the time in to try and help you; but can you put the time in to try and help others?

Chris.
 

RainLover

VIP From a land downunder
Local time
Today, 22:35
Joined
Jan 5, 2009
Messages
5,041
SmallTime.

I understand your intention; you have your solution and, for you, there is no point in wasting more of my time. I appreciate your intention.

But please try to understand the intention of this site; the solution you sort may very well be the solution others seek.

It’s not just about you and me. I put the time in to try and help you; but can you put the time in to try and help others?

Chris.

Chris

I obviously had no idea as to the solution. Some of these strange requests that you get involved in are great leaner's.

Not to worry, I will catch up with you and maybe you could explain it then.

I did notice your unsolicited solution the other day. It took me some time but I did work it out.

Cheers.
 

SmallTime

Registered User.
Local time
Today, 05:35
Joined
Mar 24, 2011
Messages
246
As soon as I've finished my current project I'll try and find the solution and post it here.
 

Users who are viewing this thread

Top Bottom