I am confused about what you have going on here. There
seems to three or four controls on the form and two fields
in a table, but maybe some of the things are only fields in
the table and not bound to controls on the form???
What is the text box control with the expression:
=IIf([Visit_Date]...
used for? Is it just to display either of the two table
fields in one place?? This of course can not be edited
because it is calculated, but then what is the text box,
txtVisit, used for beside entering a date or the text Missed
Visit??
If you want to just have one text box bound to one field in
the table and get rid of all the extra fields and controls,
then, yes, it would have to be a Text field because it would
have to contain text for Missed Visit. However this does
not sound like a good way to go about whatever the ultimate
goal is.
Maybe you should have a scheduled visit date field and a
tripple state check box to indicate that Null-don't know,
True-visit happend and False-missed visit??? I just don't
know enough to make a good suggestion about how you should
set up your table fields and form controls.
--
Marsh
MVP [MS Access]
Deborah said:
thank you for the response, however now that I have the logic that displays
one of the two fields, the form does not allow me to edit the control...is
there another way?
Should I make the visit_date field text, then just check for valid date
entry or 'Missed Visit'?
Deborah said:
Is it possible to use one control to enter values into two different
fields?
If the user enters the text - "Missed Visit" update the field
"Visit_Status"
to "Missed Visit", if the value is a date, update the field "Visit_Date"
to
the Date value.
Then, to display use: =IIf([Visit_Date] is Null and [Visit_Status] =
'Missed
Visit', "Missed Visit", Format([Visit_Date], "Short Date")
"Marshall Barton" wrote
Use the unbound control's AfterUpdate event. Let's say the
control is named txtVisit:
If IsDate(Me.txtVisit) Then
Me.Visit_Date = Me.txtVisit
ElseIf Me.txtVisit = "Missed Visit" Then
Me.Visit_Status = Me.txtVisit
Else
MsgBox "Invalid entry"
End If