darkstarjk
MIS
I have a program that is accessing a database file and have successfully edited the information and saved it back to the database. If I have a button on my form, the update works just fine. If I try to create a button on a toolbar in the Parent form of my MDI setup, it doesn't work.
I have read through this website and another and found on this site the following thread:
I tried the code that was at hand and it works, it goes into my form and executes the code, however it doesn't actually work. Let me explain in greater detail.
I have the following code on my MDI Parent form for a toolbar:
Select Case tb_MainToolbar.Buttons.IndexOf(e.Button)
Case 0
Call OpenMyFile()
Case 1
Select Case Me.ActiveMdiChild.Name
Case "CandidateInfo"
SaveMyFile_CandidateInfo(Me.ActiveMdiChild)
End Select
End Select
The sub function SaveMyFile_CandidateInfo:
Private Sub SaveMyFile_CandidateInfo(ByRef TheCurrentForm As CandidateInfo)
TheCurrentForm.SaveTheInfo()
End Sub
This executes my code on the CandidateInfo form:
Me.BindingContext(ds_CandidateInfo.Candidate_Info).EndCurrentEdit()
da_CandidateInfo.Update(ds_CandidateInfo.Candidate_Info)
As long as the button remains on the form it is fine but as soon as I try to run the code from the toolbar, it executes but does not save my changes back to the database.
This one has plagued me for the last 2 days and I am wondering if someone can please help me try and figure this out. Thanks for your time in advance.
I have read through this website and another and found on this site the following thread:
I tried the code that was at hand and it works, it goes into my form and executes the code, however it doesn't actually work. Let me explain in greater detail.
I have the following code on my MDI Parent form for a toolbar:
Select Case tb_MainToolbar.Buttons.IndexOf(e.Button)
Case 0
Call OpenMyFile()
Case 1
Select Case Me.ActiveMdiChild.Name
Case "CandidateInfo"
SaveMyFile_CandidateInfo(Me.ActiveMdiChild)
End Select
End Select
The sub function SaveMyFile_CandidateInfo:
Private Sub SaveMyFile_CandidateInfo(ByRef TheCurrentForm As CandidateInfo)
TheCurrentForm.SaveTheInfo()
End Sub
This executes my code on the CandidateInfo form:
Me.BindingContext(ds_CandidateInfo.Candidate_Info).EndCurrentEdit()
da_CandidateInfo.Update(ds_CandidateInfo.Candidate_Info)
As long as the button remains on the form it is fine but as soon as I try to run the code from the toolbar, it executes but does not save my changes back to the database.
This one has plagued me for the last 2 days and I am wondering if someone can please help me try and figure this out. Thanks for your time in advance.