auto display calculations based on date entered

  • Thread starter Thread starter laavista
  • Start date Start date
L

laavista

I have a field called "CheckInDate" (short date). The user will enter a date
in the field, then based on that date, a series of calculations are done and
displayed.
I would like the calculations to automatically calculate as soon as the date
is entered (versus having the user press a command button). I used the "on
change event" and it works well if you select a date from the calendar. When
you try to enter a date manually, as soon as you type the first number, I get
an error (not right format for the field). I think it triggerse the "on
change" as soon as I enter that first number.
- Is there anyway around this?
- Is there a way of capturing that the date is being manually entered and
calling
another procedure? or
- Is there a different event I could use instead of "on change"? (I could
not get this to work except with on change unless I'm doing something wrong)

Any help would be greatly appreciated!
 
I've tried the AfterUpdate event, but I only have the one field on the form
-- the date they enter. The rest of the fields are unbound text boxes with
the calculations. I can't move off the field to trigger the AfterUpdate.

The "on change" works well as long as you use the calendar to pick.

Thanks for responding, though.
Any other suggestions?

Also--I want to thank you for sharing your tips and techniques. Your
website has been a great resource for me. The code you created and shared
that changes a query SQL statement into a string that can be used in VBA has
been a life saver. THANK YOU.
 
Hmm: I think you're going to have problems with this.

How about adding another unbound box that can take focus.
Make it very small if you wish (e.g. width = 0.01").
In it's Enter event, put the user back in the other box, e.g.:
Me.Text0.SetFocus
 
I'll do something like that if I can't figure out anything else. Selecting
from the calendar works so slick that I'd really like to have it work when
the user enters their own date.

Thanks for your help!!
 
iletisinde şunu yazdı said:
I'll do something like that if I can't figure out anything else.
Selecting
from the calendar works so slick that I'd really like to have it work when
the user enters their own date.

Thanks for your help!!
 
Thanks everyone!

raskew via AccessMonster.com said:
I concur with Doug's evaluation. To test, I created a form
with just one textbox/label. Default of the textbox is Date()
Also added was a label, with Visible set to false.

In the after update evfent of the text box:

Private Sub Text0_AfterUpdate()
Me.Label3.Visible = True
Me.Label3.Caption = "Your input = " & Format(Me.Text0, "long date")
End Sub

Upon entering a date in Text0 and hitting Enter, it works as advertised.

Bob said:
My experience is that hitting Enter causes the AfterUpdate event to fire.
I'll do something like that if I can't figure out anything else.
Selecting
[quoted text clipped - 70 lines]
Any help would be greatly appreciated!
 
Back
Top