accessNator
Registered User.
- Local time
- Yesterday, 21:44
- Joined
- Oct 17, 2008
- Messages
- 132
I apologize in advance for a long post. But I think more the details, the better. I have two questions at the bottom of my post.
---------------
I have a mainform called frmMainForm. On this mainfrm, I have a ComboBox called cboQuickSearch which list all of my Company’s Id and Name. It is bound to the Company’s Id
Within that frmMainForm, I have a TabControl called tabFrmWorksheet.
Within, that tabFrmWorksheet, I have 3 tabbed PAGES called pgCompanyInformation, pgContactInformation, pgAgentInformation.
Within each tabbed PAGE is a SUB FORM Control.
Page Name => SubForm Name
pgCompanyInformation = > sfrmContainerCompany
pgContactInformation => sfrmContainerContact
pgAgentInformation => sfrmContainerAgent
Withn each SubForm, I have a SourceObject that I reference.
SubForm Name => SourceObject Name
sfrmContainerCompany => sfrmCompanyInformation
sfrmContainerContact => sfrmContactInformation
sfrmContainerAgent => sfrmAgentInformation
Here is what I got going on. When the USER opens my frmMain, the ComboBox is blank, and the tabControl is invisible and no SubForms are loaded. When the USER makes a selection to the ComboBox, based on the record, it will return and ID number. Based on the ID number, the TabControl: tabFrmWorksheet becomes VISIBLE, and sets the focus to the pgCompanyInformation and loads the SubForm.
Here is the code:
Here are my questions:
1. When I load up the respective SubForms, I cant seem to highlight the focus to a control within the subform. How would I achieve this?
i.e. When I load up my subForm: sfrmContainerCompany, with the Source Object sfrmCompanyInformation. I want to set focus to the textbox control called txtCompanyName.
What happens here, it doesn’t show the focus being highlighted in the subform. But, when I actually click on the subform, then it shows it being highligted and the focus set to it. I want the USER actually visually seeing the focus is being highlighted without them having to click on the subform.
Look at my code I posted called: Private Sub cboQuickSearch_AfterUpdate() and look for the SET FOCUS comment near the end.
2. When I have a USER editing the Company Information sub form, it is initially locked and cannot be edited. I have an EDIT button that if the USER clicks on it, it unlocks all of my fields for them to EDIT. This works great! Now when the USER is finished, I have another button called SAVE. When the USER clicks on the SAVE button, I wrote a piece of code where it loops through all the controls and if it detects a change, it prompts the USER that it detected some changes. Do you wish to save the record? If the USER selects NO, all the changes are Undone, but if the USER selects YES, then changes are saved.
Now here is my bugaboo. If a USER does make an EDIT, but then decides to click on another tabbed PAGE or select another ID to search for in my cboQuickSearch control, how can I prompt the USER that a change has been detected? Write now, what it does is the change is automatically written to the table. I don’t want that to happen. I want it to act like my SAVE button.
Does anyone have any ideas where I can set the proper Event to catch. Keep in mind, everytime a USER selects a new ID or clicks on another tabbed PAGE, I also have my subforms LOADING and UNLOADING depending their circumstances.
Thanks for taking the time to read all this. WHEW!!!
---------------
I have a mainform called frmMainForm. On this mainfrm, I have a ComboBox called cboQuickSearch which list all of my Company’s Id and Name. It is bound to the Company’s Id
Within that frmMainForm, I have a TabControl called tabFrmWorksheet.
Within, that tabFrmWorksheet, I have 3 tabbed PAGES called pgCompanyInformation, pgContactInformation, pgAgentInformation.
Within each tabbed PAGE is a SUB FORM Control.
Page Name => SubForm Name
pgCompanyInformation = > sfrmContainerCompany
pgContactInformation => sfrmContainerContact
pgAgentInformation => sfrmContainerAgent
Withn each SubForm, I have a SourceObject that I reference.
SubForm Name => SourceObject Name
sfrmContainerCompany => sfrmCompanyInformation
sfrmContainerContact => sfrmContactInformation
sfrmContainerAgent => sfrmAgentInformation
Here is what I got going on. When the USER opens my frmMain, the ComboBox is blank, and the tabControl is invisible and no SubForms are loaded. When the USER makes a selection to the ComboBox, based on the record, it will return and ID number. Based on the ID number, the TabControl: tabFrmWorksheet becomes VISIBLE, and sets the focus to the pgCompanyInformation and loads the SubForm.
Here is the code:
Code:
Private Sub cboQuickSearch_AfterUpdate()
' Set Focus to Company Information Tab
If Not IsNull(Me.cboQuickSearch) Then
' Tab Control is visible
Me!tabFrmWorksheet.Visible = True
' Set Focus to Company Information Tab
Me!tabFrmWorksheet.Pages(0).SetFocus
' Load Compay Information
BindSubForm sfrmContainerCompany, "sfrmCompanyInformation"
' UnBind the other Subforms
UnBindSubForm sfrmContainerContact, ""
UnBindSubForm sfrmContainerAgent, ""
' Set Focus
Forms!frmWorksheetInput!sfrmContainerCompany.SetFocus
Me!sfrmContainerCompany.Form.txtCompanyName.SetFocus
End If
End Sub
Sub UnBindSubForm(sfrmContainer As SubForm, pstrSourceObject As String)
With sfrmContainer
.SourceObject = pstrSourceObject
End With
End Sub
Sub BindSubForm(sfrmContainer As SubForm, pstrSourceObject As String)
With sfrmContainer
.SourceObject = pstrSourceObject
.SetFocus
End With
End Sub
1. When I load up the respective SubForms, I cant seem to highlight the focus to a control within the subform. How would I achieve this?
i.e. When I load up my subForm: sfrmContainerCompany, with the Source Object sfrmCompanyInformation. I want to set focus to the textbox control called txtCompanyName.
What happens here, it doesn’t show the focus being highlighted in the subform. But, when I actually click on the subform, then it shows it being highligted and the focus set to it. I want the USER actually visually seeing the focus is being highlighted without them having to click on the subform.
Look at my code I posted called: Private Sub cboQuickSearch_AfterUpdate() and look for the SET FOCUS comment near the end.
2. When I have a USER editing the Company Information sub form, it is initially locked and cannot be edited. I have an EDIT button that if the USER clicks on it, it unlocks all of my fields for them to EDIT. This works great! Now when the USER is finished, I have another button called SAVE. When the USER clicks on the SAVE button, I wrote a piece of code where it loops through all the controls and if it detects a change, it prompts the USER that it detected some changes. Do you wish to save the record? If the USER selects NO, all the changes are Undone, but if the USER selects YES, then changes are saved.
Now here is my bugaboo. If a USER does make an EDIT, but then decides to click on another tabbed PAGE or select another ID to search for in my cboQuickSearch control, how can I prompt the USER that a change has been detected? Write now, what it does is the change is automatically written to the table. I don’t want that to happen. I want it to act like my SAVE button.
Does anyone have any ideas where I can set the proper Event to catch. Keep in mind, everytime a USER selects a new ID or clicks on another tabbed PAGE, I also have my subforms LOADING and UNLOADING depending their circumstances.
Thanks for taking the time to read all this. WHEW!!!