N
Nathan-bfhd
I have a Main form with Individual information (First Name, Last Name,
Contact Info, etc) and a subform with Specialty Information (Surgeon,
Pharmacist, Dentist, etc). I need to set this form up so that the specialty
field must be populated in the subform IF there is a phone number given for
the Individual. As it currently is, users are able to enter the Individuals
info without being forced to enter specialty information (any time a phone
number is provided within the Individual's information).
I have tried using the before update event for the form to place an if
statement checking to see if the phone number field from the Main form is
populated and if the specialty field from the subform is = 0 (it's a combo
box with a specialty ID who's default value is 0). If the above scenario is
true, I use the cancel command coupled with a MsgBox message to keep it from
updating which also keeps the user from being able go to a different record.
That part seems to work fine, the problem is that with that code, I also
cannot click into the subform to populate the Specialty control that I need
to because when I click in the subform it tries to update the Main form.
My questions:
Is there a better way to keep a user from going on to the next record when
they have entered a phone number in the main form and not entered specialty
information in the subform?
Is there a way to use the code I described above and just set the focus of
the form to the Specialty subform control so that after the message pops up
telling them they need to select a specialty, the focus is also on that
control? Currently when I try and set the focus to that control it tells me
that it cannot move the focus to that control.
Contact Info, etc) and a subform with Specialty Information (Surgeon,
Pharmacist, Dentist, etc). I need to set this form up so that the specialty
field must be populated in the subform IF there is a phone number given for
the Individual. As it currently is, users are able to enter the Individuals
info without being forced to enter specialty information (any time a phone
number is provided within the Individual's information).
I have tried using the before update event for the form to place an if
statement checking to see if the phone number field from the Main form is
populated and if the specialty field from the subform is = 0 (it's a combo
box with a specialty ID who's default value is 0). If the above scenario is
true, I use the cancel command coupled with a MsgBox message to keep it from
updating which also keeps the user from being able go to a different record.
That part seems to work fine, the problem is that with that code, I also
cannot click into the subform to populate the Specialty control that I need
to because when I click in the subform it tries to update the Main form.
My questions:
Is there a better way to keep a user from going on to the next record when
they have entered a phone number in the main form and not entered specialty
information in the subform?
Is there a way to use the code I described above and just set the focus of
the form to the Specialty subform control so that after the message pops up
telling them they need to select a specialty, the focus is also on that
control? Currently when I try and set the focus to that control it tells me
that it cannot move the focus to that control.