Access 2007 - General-Date Field with 2 Text Boxes

xolo

Registered User.
Local time
Tomorrow, 00:39
Joined
May 6, 2009
Messages
34
I have a "general-date" field but I want to use two text boxes to input and display the field's value on one form. One text box is for the date part and the other one for the time part. What is the best way to do this?
 
Control Source

Date:
=Format([YourDateField],"dd/mm/yyyy")

Time:
=format([YourDateField],"h:nn am/pm")

make sure that you disable the editing of these fields
 
Control Source

Date:
=Format([YourDateField],"dd/mm/yyyy")

Time:
=format([YourDateField],"h:nn am/pm")

make sure that you disable the editing of these fields

Thanks David,

But isn't it only to display the field's value? I want also to input the field from the same text boxes.
 
Are you saying you want the user to enter a date and a time in seperate controls on a form then store the date and time as one field in you table?

If so, why have it in two controls on a form? why not one?
 
Yes.

I want to have default value of "Date()" for the date part and "#23:59#" for the time part. In case the user enters or updates the date text-box with another value, the time part will still be #23:59#, and vice versa. I need these two text-boxes act like if I had this date with two fields to separate the date and time part.
 
Yes.

I want to have default value of "Date()" for the date part and "#23:59#" for the time part. In case the user enters or updates the date text-box with another value, the time part will still be #23:59#, and vice versa. I need these two text-boxes act like if I had this date with two fields to separate the date and time part.
If your time value isn't going to change then I don't think it would be necessary to save it. Just set the text box's value to 23:59 on the Load event of the form and lock or disable it. For the date part, you will find a Default Value property, put Date() in there. Best to do it on your table.
 

Users who are viewing this thread

Back
Top Bottom