With regard to your question: Is the "TypeOfSurg ery" control on the
form a combo box where the rowsource for the combo box from a another
table?
No, the display control: is a combo box
row source type: Value List
row source: Cardiac Surgery, Colon Surgery, Hip Replacement
etc.
bound column 1
column count 1
What I wanted to accomplish is this: If the TypeofSurgery is Colon
Surgery, I wanted the OralAntibiotics to have either a Y or N in that
field.
If other than Colon Surgery, the cursor would move to the next
appropriate field, that being "AntibioticAlle rgy".
After some work this weekend here is the answer.
There were two Procedures built:
One on enter:
Private Sub Oral Antibiotics_Ent er()
If Me.TypeofSurger y <> "Colon Surgery" Then
DoCmd.GoToContr ol "AntibioticAlle rgy"
End If
End Sub
The second on exit:
Private Sub Oral Antibiotics_Exi t(Cancel As Integer)
If Me.TypeofSurger y ="Colon Surgery" Then
If IsNull(Me.OralA ntibiotics) Then
MsgBox "Data Entry Required - Enter a Y or an N!"
Cancel = True
End If
End If
End Sub
I certainly appreciate everyone's help on this just being able to
discuss this with someone and coming back fresh after awhile made a
lot of difference.
Stewart your code gave me the idea of breaking this action into two
procedures, a special thanks to you as well.
Kenny G
"Stewart Allen" <sa****@ThisPar tNotVailid.wave .co.nz> wrote in message news:<bs******* ***@news.wave.c o.nz>...
Is the "TypeOfSurg ery" control on the form a combo box where the rowsource
for the combo box from a another table?
If it is, does each surgery type have its own ID number so its only the
number being stored in the main table so the combo box's recordsouce has 2
columns, SureryTypeID and SurgeryType where the SurgeryTypeID is bound to
the main table with the column widths set at 0cm; 3cm hiding the first
column?
If the control on the form is a combo box pulled from a table as above
change the code to:
If Me.TypeOfSurger y.Column(1) = "Colon Surgery" And Me.Dirty = True Then
This will read the second column of the combo box and not the first.
Please post back if this doesn't work or you're using some other method to
store the data.
Stewart
"Kenny G" <kg****@hotmail .com> wrote in message
news:81******** *************** ***@posting.goo gle.com... Thanks for your response, the code and your good explaination of that
code seem to make sense. I entered the code and if Colon Surgery is
selected I am still not prompted for a Y or N response in
OralAntibiotics .
Kenny G