Tab out of a subform

fionahl

Registered User.
Local time
Tomorrow, 00:26
Joined
Jun 25, 2009
Messages
11
I've searched the forums - apologies if this has already been answered. :o

I have a main form (patients) with a subform (employment details). On the subform, I have various controls for employment details. One of these is for Job title. This is currently another subform (disguised as a combo box), which will search for job titles drawing from another form. It has code (on Not In List) so that if a job title isn't listed, the user can add it to a form without leaving the main form.

I have the sub-subform (combo box) embedded nicely in the subform so it looks like a regular combo box. I have set up the tab order so that I can work through the Employment subform (date started, finished, job description etc). I can tab into the subform, but am not able to tab out of it, as it is a subform, and keeps adding new records when I hit tab.

Each employment record only needs one job title (drawn from the combo box), but I can add multiple jobs for each patient with the employment subform if necessary.

Am I able to set it up so that I can tab out of the combo box (sub-subform) so that it won't keep trying to go to another record? I have tried adding code GoToControl, On Enter, On Update etc, but my programming knowledge is very poor so nothing worked!

Any suggestions??? :confused:

PS thanks in advance for any help offered!!! :cool:
 
Thanks for the link John.

I've tried a few combinations of code in the On Lost Focus field as suggested by Luddite Lad , however haven't had much success.

A few trials that didn't work:

Private Sub OccListID_LostFocus()
If Me.OccListID = Null Then
JobDescription.SetFocus
End If
End Sub

Private Sub OccListID_LostFocus()
If Me.OccListID = Null Then
DoCmd.GoToControl JobDescription
End If
End Sub

Private Sub OccListID_LostFocus()
If Me.OccListID = Null Then
DoCmd.GoToControl Forms!Employment!JobDescription
End If
End Sub


I really don't have much programming experience, so I'm very much in the dark!


Many thanks!
 
See my response in the other thread.
 

Users who are viewing this thread

Back
Top Bottom