dmiles
Jul 29 2009, 05:04 PM
I have a form that has multiple subforms with it, I am tryong to move the focus out of one subform to antoher if there is no information input on the first subform, basically trying to get the tab control to move out of the current subform to the next subform. Here is the code
CODE
Private Sub Name_GotFocus()
Dim db As Database
Set db = CurrentDb
If PriorityLevel = 0 Then
Form_MHE_Support.Type.SetFocus
Form_MHE_Support.Type.BackColor = vbRed
DoCmd.CancelEvent
Else
MsgBox "Test"
End If
End Sub
theDBguy
Jul 29 2009, 05:34 PM
Hi,
The safest route is to move the focus in this order:
1. Main Form
2. Subform container
3. Subform
4. Subform Control
Hope that helps...
dmiles
Jul 29 2009, 06:44 PM
Still lost anyone? I am haveing a pro blem moving the focus,, it seems that the program is overriding my tab and setting the focus back to Name in the first subform when it should be moving the focus to Materials.MHE_support.type
dmiles
Jul 30 2009, 10:27 AM
I am still not able to move the focus, even trying to move it to the main form first,
Doug Steele
Jul 30 2009, 02:59 PM
How about you show the code you're currently trying to us, so we can see whether you implemented theDBguy's instructions properly?
dmiles
Jul 30 2009, 04:55 PM
Here is the code I am trying, still lno luck..
CODE
Private Sub Name_GotFocus()
Dim db As Database
Set db = CurrentDb
Dim Materials As SubForm
Set Materials = Materials
If PriorityLevel = 0 Then
Form_frmIncidentSupportBases.SetFocus
Materials.SetFocus
Form_MHE_Support.SetFocus
Form_MHE_Support.Type.BackColor = vbRed
Form_MHE_Support.Type.SetFocus
Else
MsgBox "Test"
End If
End Sub
dmiles
Jul 30 2009, 05:09 PM
this does not seem to be that hard of a task, simply move out of the one subform witht the tab and move to a different subform..
theDBguy
Jul 30 2009, 06:11 PM
Hi dmiles,
No it shouldn't as long as you know the proper syntax to use. Perhaps this
table would help.
Good luck!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.