This doesn’t seem to be as easily resolved as I originally thought. I should
probably just let this go but I don’t want to give up if there is a chance I
can get it going. I don’t seem to be able to get the results I would like to
see. I don’t know if it was clear in my last posting, the steps I took.
Except for the change to the query, the steps are the same with your first
instructions as with your latest. I’m going to post each and every step I
took in the hope that you can point out any missteps.
1. Opened the form in design view and changed the query to include the
modified IIF statement, IsPending: IIF(IsNull([RcvdDate]), “Pendingâ€, Null)
which I added to a vacant field in the query grid.
2. Saved the query.
3. Confirmed that txtRcvdDate is bound, control source is [RcvdDate]
4. Changed the control source of txtRcvdDate2 to IsPending, now part of the
field list.
5. Verified that I had the property settings correct for txtRcvdDate2 per
your instructions; enabled = No, tab stop = No, Locked = Yes) I changed the
settings with your last posting but confirmed that they are as you instructed.
6. Repositioned txtRcvdDate2 *OVER* txtRcvdDate, as before, using the left,
top, and height measurements that I copied from txtRcvdDate.
Here is the SQL from the modified query:
SELECT tblKeysRequests.RequestID, tblKeysRequests.KeyID,
tblKeysRequests.EmpID, tblKeysRequests.RqstDate,
tblKeysRequests.QtyRequested, tblKeysRequests.RcvdDate,
tblKeysRequests.QtyRecd, tblKeysRequests.Reason, tblKeysRequests.Complete,
tblKeys.KeyCode, IIf(IsNull([RcvdDate]),"Pending",Null) AS IsPending
FROM tblKeys INNER JOIN tblKeysRequests ON tblKeys.KeyID =
tblKeysRequests.KeyID
ORDER BY tblKeys.KeyCode;
7. Flipped the form to form view.
8. I see the words “Pending†for those records that used to be blank. This
is good.
9. I see a blank textbox for those records that previously had a received
date. This is not good. The received dates previously entered should not
change. Those records are complete.
10. I cannot enter any information into the Rcvd textbox.
I understand when you say the Pending textbox is not editable. I thought
when I tabbed into the textbox that says, “Pendingâ€, I was actually editing
the RcvdDate textbox which should now be active. If I understand correctly,
this will allow me to input a received date as pending requests are filled. I
have followed your instructions line by line (I don’t think I missed
anything) and re-read your explanations. I understand what you’re saying. I
just don’t understand why this isn’t working.
--
Aria W.
John W. Vinson said:
For one thing you cannot update a Date/Time field to "Pending". That's a text
string, and you cannot store text strings in a date/time field - only
date/time values!
OK.
I would suggest instead having a *SECOND* textbox on the form, perhaps
superimposed over the date field textbox. Set its Control Source to
=IIF(IsNull([RcvdDate]), "Pending", Null)
Set its Enabled property to No, Locked to Yes, TabStop to No so the user can't
mess with it; if it's carefully sized and positioned just atop the RcvdDate
textbox, then the user can click or tab into the RcvdDate box and type (or
edit) a date. You may need to requery this new textbox in the RcvdDate
textbox's AfterUpdate event.
I'm having a bit of a problem with this part. I have created the 2nd textbox
and set the properties as you directed. I used the AfterUpdate event of the
[RcvdDate] textbox to requery the new textbox [RcvdDate2]. I see "Pending"
but the records that did have a date are now null.
I set the control source to:
=IIf(IsNull([RcvdDate]),"Pending",Null)
The other problem is that I can't enter a date into the textbox when it says
"pending". I now receive the following error message,"Control can't be
edited; it's bound the the expression 'IIf(IsNull([RcvdDate])," "Pending",
Null'. Can you see where I made a mistake?
You tried to edit the Pending textbox.
IT IS NOT EDITABLE. It makes no sense to edit it. It's *just for display*. If
you want to edit something, edit RcvdDate. The textbox properties I described
should make it impossible to set focus to the Pending textbox or to type in it
at all (so you wouldn't get this message).
Since you're apparently using a continuous form (a point I missed, sorry!),
try a different technique. Base the form on a Query of your table. Include
RcvdDate in the query, and put in a calculated field by typing
IsPending: IIF(IsNull([RcvdDate]), "Pending", Null)
in a vacant Field cell in the query grid. Bind one textbox to RcvdDate for
editing, and a second textbox (Enabled = No, Tab Stop = No, Locked = Yes) to
IsPending. You can - again - carefully move the IsPending textbox so that it
is superimposed *OVER* the RcvdDate textbox; when you click into the (two
superimposed) textboxes, or tab into it, the editable RcvdDate textbox will
become active, but you'll still see the word Pending if appropriate.