Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MDI Child and Toolbar / Menu

Status
Not open for further replies.
Jul 5, 2001
40
0
0
US
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.
 
Ok, it was really stupid. I found this thread:
I set up the form to find focus on a group box I have before the following code:

Me.BindingContext(ds_CandidateInfo.Candidate_Info).EndCurrentEdit()
da_CandidateInfo.Update(ds_CandidateInfo.Candidate_Info)

END RESULT

grp_GeneralInfo.Focus()
Me.BindingContext(ds_CandidateInfo.Candidate_Info).EndCurrentEdit()
da_CandidateInfo.Update(ds_CandidateInfo.Candidate_Info)

Sorry for wasting everyone's time.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top