Possible for both ways for Date Entry on a txtField?

K

KarenY

Hi,
I have a field (IssuedDate) on a Form for the users to enter the date, in
order to give the convenience for the user, I have set up the some key-codes
for them to input instead of typing the full date and it works out great.
(I've learned that from one of the old threads, but I couldn't find more to
resolve my following problem. Believe or not, I have searched for that in
about 2 days already.)

Since I have only set up for a total of 8 keys only, that means 7 days
backwards, then it won't work for the users who are away for vacation more
than 8 days and they can't input the date manually because of the setting.
Is there a way for both possibilities ? The users appreciate for the
Key-code, yet I don't think its efficient for me to set up so many key-codes.
I was hoping there must be a way to allow both ways.
Please help or any other ideas ?

Herebelow is my present setting:

Private Sub DateIssued_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
Case 48 '0
KeyAscii = 0
Screen.ActiveControl = Date

Case 49 '1
KeyAscii = 0
Screen.ActiveControl = Date - 1

End Select

I have set up up to the Case 55 for Date - 6, etc.
Please help to add an extra possibility to allow a manual date input in
DateIssued. If there is no other way, I have to remove the event and the
date will be input manually for all (a pity because of my limited knowledge).

thanks
Karen
 
E

engles

Hi,
I have a field (IssuedDate) on a Form for the users to enter the date, in
order to give the convenience for the user, I have set up the some key-codes
for them to input instead of typing the full date and it works out great.
(I've learned that from one of the old threads, but I couldn't find more to
resolve my following problem. Believe or not, I have searched for that in
about 2 days already.)

Since I have only set up for a total of 8 keys only, that means 7 days
backwards, then it won't work for the users who are away for vacation more
than 8 days and they can't input the date manually because of the setting.
Is there a way for both possibilities ? The users appreciate for the
Key-code, yet I don't think its efficient for me to set up so many key-codes.
I was hoping there must be a way to allow both ways.
Please help or any other ideas ?

Herebelow is my present setting:

Private Sub DateIssued_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
Case 48 '0
KeyAscii = 0
Screen.ActiveControl = Date

Case 49 '1
KeyAscii = 0
Screen.ActiveControl = Date - 1

End Select

I have set up up to the Case 55 for Date - 6, etc.
Please help to add an extra possibility to allow a manual date input in
DateIssued. If there is no other way, I have to remove the event and the
date will be input manually for all (a pity because of my limited knowledge).

thanks
Karen

Why not trap the minus key? If active control is blank. set it to
today;else decrement by 1.

-- Larry Engles
 
K

KarenY

thanks for reply.
Would you please explain a bit, sorry.
If the -1 is gone, it will be today's day. The date to be filled out in the
field is always the past date, that's why I used -1 for yesterday and up to a
week ago -7.

thanks
karen
 
E

engles

thanks for reply.
Would you please explain a bit, sorry.
If the -1 is gone, it will be today's day. The date to be filled out in the
field is always the past date, that's why I used -1 for yesterday and up to a
week ago -7.

thanks
karen







- Show quoted text -

Check the value in the control. If it is null, then today's date;
else set the new control value to the current control value minus 1.

e.g.
With your control named DateIssued

if (isnull(me.DateIssued)) then
me.DateIssued = Date()
else
me.DateIssued = me.DateIssued - 1
endif

Should work.

-- Larry Engles
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top