Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple but tought time and date question

Status
Not open for further replies.

dominicgingras

Technical User
Jul 15, 2002
53
CA
I have a database designed for a shipping company. Their is a field for the time of the pickup. Of course I need to stock the time and the date for the pickup. But when its time for data entry on the form, how do you guy create a field to enter a full time and date. For example if you enter that information from one field on the form it’s very annoying to do it with the input mask. So maybe I should create to field in the database? But that option would not make a lot of sense. Do you have any idea?
 
dominic,
If a user has to enter time, it's going to be somewhat tedious any way you look at it. An input mask will force a proper format, but you can also allow 'free-form' input, and let the user know that dots will serve as colons, for example, and the date formatting will automatically convert, say 10/5/2002 10.25 to 10/5/2002 10:25:00 AM.

Again, entering times is going to be keystroke intensive, and there's no way to make it easier, unless the time happens to be the current time, where you can automatically have Now() popped into the field.
--Jim
 
That why I wanted to use two field on the from and combine the result after. But I dont know how to do this.
 
Okay, I am just about to do this so I'll try and tell you how I propose to do it.

On our database we store the date and times of our despatch. Currently the date and time are entered in via one text box. So like our friend is saying in the form 99/99/99 99:99 which isn't user friendly.

I want to give the users the option to enter the date and time separately.

REMEMBER very important all Date/Time fields hold date and time. You select to input or view one or the other but they are both always there.

Let me give a bit more background now. I thought I'd have 2 boxes - one for the despatch date only, one for the despatch time only. This date and time are from the SAME field but using a DIFFERENT view (i.e. short date, short time). So as a result it behaves very strangely.

As changing either the Date or the Time sets the other to it's default. E.g. setting just the date sets time to 12:00.

Using the 'Before Update' method on the date and time I propose to add these components together before saving into the Despatch date/time then refresh the form. This method happens before the change is saved so it can be undone.

The point I've become stuck on is how to separate and later combine the date and time. There doesn't seem to be any functions to do this. It may be a matter of exploring the datatype and breaking it up in terms of bytes?!

Or perhaps manipulating it as a String then converting back to a Date/Time type?

I will post a further answer later when I've done it.

Leon.
 
I guest they must be a lot of people having this problem. I wonder if anybody else has more Idea. I tried several ways using before update and after update and combining the field using & "" & but so far I did not get very good result.
 
Hello, I just skimmed your thread here I think I would have a solution that would take you into a little more code and control over the data on the screen.

on refresh or load have the date/time field be split into two Date/time variables. Assign the form text boxes to these variables. On update or unload have the VBA check the variable for integrity and then save it back to the me.recordset.

Just and off shoot idea.

Urbane Rove
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top