Larry Brister
asked on
MS Access VBA
I have inherited a mess.
A MS Access app (ADP) with many many nested forms.
In this wuestion I have
Parent Form
Subform
SubSubForm on SubForm
On the parent form I have a combobox (cmbVisits)
On the ParentForm cmbVisits_Change() event I want to
execute a public sub on SubForm
execute a public sub on SubSubForm
I'm able to execute the sub form public sub with this...
Me!ClientVisitContactEvent .Form.load Questions
I've tried all kinds of permutations of the sub sub form
Like this one...all with a object error message
Me!MarketingVisitationClie nt.Marketi ngVisitati onClientCo ntactsWork list.Form. loadContac tData
A MS Access app (ADP) with many many nested forms.
In this wuestion I have
Parent Form
Subform
SubSubForm on SubForm
On the parent form I have a combobox (cmbVisits)
On the ParentForm cmbVisits_Change() event I want to
execute a public sub on SubForm
execute a public sub on SubSubForm
I'm able to execute the sub form public sub with this...
Me!ClientVisitContactEvent
I've tried all kinds of permutations of the sub sub form
Like this one...all with a object error message
Me!MarketingVisitationClie
ASKER
fyed
This is the actual forms and path left to right...still getting same error messgage
Me!MarketingVisitationClie nt.Form.Ma rketingVis itationCli entContact sWorklist. Form.loadC ontactData
This is the actual forms and path left to right...still getting same error messgage
Me!MarketingVisitationClie
You will have to provide more details.
Is the SubSubforms actually nested inside the SubForm, or are there just two subforms on the main form?
What are the Control Names of each of the subform controls (don't confuse this with the value in the SourceObject property of each item.
Is the SubSubforms actually nested inside the SubForm, or are there just two subforms on the main form?
What are the Control Names of each of the subform controls (don't confuse this with the value in the SourceObject property of each item.
You might have to declare that function (in the code section of the SubSubForm) from Private to Public.
As mentioned above, make sure you are using the "control names" and not the "source Object" to refer to these subforms.
As mentioned above, make sure you are using the "control names" and not the "source Object" to refer to these subforms.
ASKER
fyed
On the main (ClientVisits) form is the combobox
This same ClientVists form has 3 sub forms...and the first one has it's own sub form
1. MarketingVisitationClient
a. MarketingVisitationClientC ontactsWor klist
2. ClientVisitContactEvent
3. ClientVisitsNearbyLV
I can execute the public sub on #2 with
Me!ClientVisitContactEvent .Form.load Questions
I am trying to execute the public sub on 1.a. named loadContactData
On the main (ClientVisits) form is the combobox
This same ClientVists form has 3 sub forms...and the first one has it's own sub form
1. MarketingVisitationClient
a. MarketingVisitationClientC
2. ClientVisitContactEvent
3. ClientVisitsNearbyLV
I can execute the public sub on #2 with
Me!ClientVisitContactEvent
I am trying to execute the public sub on 1.a. named loadContactData
ASKER
fyed...
It IS a public sub in the sub sub form.
It IS a public sub in the sub sub form.
Public Sub loadContactData()
Dim cmd1 As New ADODB.Command
Dim rst1 As ADODB.Recordset
cmd1.ActiveConnection = CurrentProject.Connection
cmd1.CommandType = adCmdStoredProc
cmd1.CommandText = "usp_MarketingVisitContactsGet"
cmd1.Parameters("@VisitID") = Nz(Me.Parent.cmbVisits, 0)
cmd1.Parameters("@ClientID") = Me.Parent.txtClientID 'Me.Parent.Parent.getClientID()
Set rst1 = cmd1.Execute()
End Sub
ASKER
fyed,
Also...to make sure I was able to see the first subform from the parent (ClientVisits) I ran a messagebox in the following call and it worked
Me!MarketingVisitationClie nt.Form.do Message
I'm just not reaching 1.a from my list above
Also...to make sure I was able to see the first subform from the parent (ClientVisits) I ran a messagebox in the following call and it worked
Me!MarketingVisitationClie
I'm just not reaching 1.a from my list above
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
1. Are you certain it is running the other code (loadQuestions). Have you put a breakpoint in that code and stepped through it?
2. Are you certain that subform is actually loaded at the point where this occurs? Instead of trying to run code on that subform, try popping up a message box with the value in one of the controls on that subform.
msgbox me.MarketingVisitationClie nt.form.Ma rketingVis itationCli entContact sWorklist. form.txtSo meControl
I must admit that I have never felt the need to call a subroutine nested in the code module of a sub-sub form. Is there a reason that this code could not go into a general code module, rather than a forms code module?
Is there a reason you could not call that procedure from within the LoadQuestions subroutine of the MarketingVisitationClient form?
Instead of
2. Are you certain that subform is actually loaded at the point where this occurs? Instead of trying to run code on that subform, try popping up a message box with the value in one of the controls on that subform.
msgbox me.MarketingVisitationClie
I must admit that I have never felt the need to call a subroutine nested in the code module of a sub-sub form. Is there a reason that this code could not go into a general code module, rather than a forms code module?
Is there a reason you could not call that procedure from within the LoadQuestions subroutine of the MarketingVisitationClient form?
Instead of
ASKER
fyed,
Well...this entire forms set is part of a much larger Client Visits and Schedu;ing process.
I must admit, it's been years since I was in MS Access. been in AJAX .Net Web Forms and WinForms until this recent job.
The forms are all datasheet views so it's functioning like a hierachy based set of GridViews
Without going into the gory details...
I can't just use a view etc to call in the data.
These forms are all filtered by the Combobox.
How would I do that on my sub_sub form based on the conbobox click...using a general code module?
Well...this entire forms set is part of a much larger Client Visits and Schedu;ing process.
I must admit, it's been years since I was in MS Access. been in AJAX .Net Web Forms and WinForms until this recent job.
The forms are all datasheet views so it's functioning like a hierachy based set of GridViews
Without going into the gory details...
I can't just use a view etc to call in the data.
These forms are all filtered by the Combobox.
How would I do that on my sub_sub form based on the conbobox click...using a general code module?
ASKER
fyed
If I go to the sub sub form and put in the stored procedure I can then open the form and (since there are two paramaters to the stored procedure @ClientID and @VisitID) ...
I can manually enter a ClientID and a VisitID and get the data.
Is there any way to tie that stored proc to the Parent.Parent.Combobox?
If I go to the sub sub form and put in the stored procedure I can then open the form and (since there are two paramaters to the stored procedure @ClientID and @VisitID) ...
I can manually enter a ClientID and a VisitID and get the data.
Is there any way to tie that stored proc to the Parent.Parent.Combobox?
ASKER
fyed,
Everything you've pointed out to me is correct.
I know for a fact it works because I've done it in a second database with a similar setup.
There's just something in this particular database that isn't working.
Since your reply 38724563 was what worked in a second database I'll accept that.
Looks like I'll have to find a work around.
Everything you've pointed out to me is correct.
I know for a fact it works because I've done it in a second database with a similar setup.
There's just something in this particular database that isn't working.
Since your reply 38724563 was what worked in a second database I'll accept that.
Looks like I'll have to find a work around.
Me!clientVisitContactEvent
the syntax would normally be:
Me.subformControlName.Form