How do I run code from a sub form within a sub form from another module?
I tried:
Run Forms![frmClientsPolicies]![frmsubPoliciesForThisClient]![Policy Details].txtFunds_DblClick
but got an error
Running a nested sub form's code
-
- 5StarLounger
- Posts: 962
- Joined: 09 Feb 2010, 00:33
- Location: Patterson Lakes, Victoria, Australia
Running a nested sub form's code
Avagr8day, regards, Peter
-
- Administrator
- Posts: 78629
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Running a nested sub form's code
Have you made txtFunds_DblClick a Public procedure? By default, event procedures are always Private. So:
Public Sub txtFunds_DblClick(Cancel As Integer)
Public Sub txtFunds_DblClick(Cancel As Integer)
Best wishes,
Hans
Hans
-
- Administrator
- Posts: 78629
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Running a nested sub form's code
Oh, and call it like this:
Dim intCancel As Integer
Call Forms![frmClientsPolicies]![frmsubPoliciesForThisClient]![Policy Details].txtFunds_DblClick(intCancel)
Not Run!
Dim intCancel As Integer
Call Forms![frmClientsPolicies]![frmsubPoliciesForThisClient]![Policy Details].txtFunds_DblClick(intCancel)
Not Run!
Best wishes,
Hans
Hans
-
- 5StarLounger
- Posts: 962
- Joined: 09 Feb 2010, 00:33
- Location: Patterson Lakes, Victoria, Australia
Re: Running a nested sub form's code
Made the sub a Public one.
dimmed intCancel As Integer
But I get a compile error on the Call line. Tried brackets before Forms! and at end, but still error.
dimmed intCancel As Integer
But I get a compile error on the Call line. Tried brackets before Forms! and at end, but still error.
Avagr8day, regards, Peter
-
- Administrator
- Posts: 78629
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
-
- Administrator
- Posts: 78629
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Running a nested sub form's code
I'll be away from my computer for several hours. I'll look at your problem when I get back.
Best wishes,
Hans
Hans
-
- 5StarLounger
- Posts: 962
- Joined: 09 Feb 2010, 00:33
- Location: Patterson Lakes, Victoria, Australia
Re: Running a nested sub form's code
If I remove the 'Call', the procedure compiles. But when it runs I get an error at that line:
"Object doesn't support this property or method"
"Object doesn't support this property or method"
Avagr8day, regards, Peter
-
- Administrator
- Posts: 78629
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Running a nested sub form's code
Try this version:
Code: Select all
Dim intCancel As Integer
Forms!frmClientsPolicies!frmsubPoliciesForThisClient![Policy Details].Form.txtFunds_DblClick intCancel
Best wishes,
Hans
Hans
-
- 5StarLounger
- Posts: 962
- Joined: 09 Feb 2010, 00:33
- Location: Patterson Lakes, Victoria, Australia
Re: Running a nested sub form's code
Yep, that worked!
My stamp's ink is running out from over use.You do not have the required permissions to view the files attached to this post.
Avagr8day, regards, Peter