Combobox time

B

Billiam

I have a reference/lookup table named StartTime, StartTimeID PK, autonumber,
with field StartTime (format date/Time, medium time format)

I bulit a form on t-employees with a subform t_timesheet.

Simply, I added a bound combobox lookup which displays the time as entered
in the lookup/reference table as 7:30 am (medium time).

When I select this from the combo box, I get the message that the value is
in the wrong format...

I checked the field it is bound to t-timesheet field StartTime, it is format
date/Time, medium time, I checked the lookuptable, it is date/Time meium time
format. values that had been in the table prior to changing to a combobox
dropdown now include seconds (which is Long time, which i did not choose
anywhere). In other words, instead of it saying 7:30 am as it should, it is
displaying 7:30:00 am.

Can anybody help me with this?
many thanks,

Billiam
 
D

Duane Hookom

I expect your combo box might be bound to the AutoNumber field. If this is
the case, you shouldn't attempt to store it in a date/time field. Don't get
hung up on how a datetime value is stored. Every datetime field is store in
exactly the same way. It's a float number where the whole number portion is
the number of days since 12/30/1899 and the decimal part is the portion of
the day. For instance .25 is 6:00 AM.

What caused someone to create a lookup table for the time entry with an
Autonumber?
 
B

Billiam

Hi Duane,

To answer your question, i'm betting the answer is, *politely*, inexperience?

Simply, I am trying to make it as easy as possible for someone to enter
their timesheet info...i thought creating the combobox from a lookup table
was a good idea...of course I forgot the autonumber ID is being stored...not
the 'time"
So I fixed that and everything works now.

Is it wrong to store the ID field with time...I thought that is what you are
supposed to do with a combobox? I realize each time is unique and could be
used as it's own PK, but habit just made me do it with an autogenerated PK.
Looking at this now, i suppose i could accidently enter in 11:30 am twice. Is
this the point you are making?

I'm afraid I am not very good at this. BTW I am using Access 2007.

Billiam
 
D

Duane Hookom

If I wanted to create a combo box for time entry, I would probably use a
generic function that returns time values from a start to end time and with a
specific minute interval. A decent alternative is a lookup table but it
wouldn't be quite as flexible.
 

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