bound date textbox, getting date and time from user

hey guys, i've got a bound date textbox. i want to get both date AND time from the user. and i want to ensure that the user fills in the time as well, not just leave it to default of 12:00:00 AM. what's the best way to do this? am sure yall have faced this countless times before!

what i'm thinking is - for the date part i'll use Allen Browne's calendar form to fill an unbound textbox. for the time part i'll use an unbound combobox and then i'll use the after update event to join these two together an populate a bound invisible textbox.

do yall think that's the best way to do it?

how can i avoid using vba code at all? is there any way to concatenate 2 unbound textbox values into a bound textbox?

thanks guys!! = ))
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Gustav BrockCIOCommented:
You can use BeforeUpdate to check:

  Cancel = (DateValue([txtDateTime]) = CDate([txtDateTime]))

or you could use separate textboxes for date and time and check for a time of Null, then:

  datDateTime = CDate([txtDate]) + CDate([txtTime])

developingprogrammerAuthor Commented:
thanks gustav! but how do i do this without VBA? is it possible?

if i set the control source of a textbox to the joining of the 2 textboxes' values then i cannot bind that textbox to the recordsource already.

i'm trying to figure out how to do this without code = ) thanks!!
Gustav BrockCIOCommented:
No VBA is needed.

If you have a field with the combined data, you can split the date and time to the two unbound textboxes at the OnCurrent event.

  Me![txtDate].Value = DateValue([DateTime])
  Me![txtTime].Value = TimeValue([DateTime])

After update of either:

  Me![txtDateTime].Value = Nz(CVDate([txtDate]), Date) + Nz(CVDate([txtTime]), #00:00#)


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
developingprogrammerAuthor Commented:
whao gustav, really cool. using the events properties of the control itself. i never thought about that. and also being able to set the Cancel variable in the events property itself. very nice. thanks for opening up my mind once again gustav! = )
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.