Short Date appearing as a long date in combo box

Jaysoul

New member
Local time
Today, 09:21
Joined
Nov 16, 2006
Messages
9
Hi people,

I could do with some help,

I have a combo box which holds a list of times which I have entered in it.

eg. 08:00, 08:30, 09:00 09:30, 10:00

I have set the format of the combo box to be short time 00:00

However, when I move the value that has been selected in the combo box to either an sql query or a text box say...

Me.txtbox1.value = me.combo.value

When the value is transferred I get a long looking time like this 08:30:00

Can anyone tell me why this is happening and how I can get it to just appear as a short time like 08:30

Many Thanks
Jay
 
CrystalSurfer: "mm" is not the value to use for minutes. That is the designation for a two digit month. "nn" is minutes.

Jaysoul: Set the format for the text box in the properties as ShortDate. When formatting objects in Access you'll soon find out (like now) that formatting doesn't flow from one object to another (occasionally there are exceptions).
 
"hh:mm" seems to work for me??!
and so does "hh:nn"!! :)

I did notice that when you enter the above into SQL View and then switch to Design View, Access (2003) translates it into "Short Time".
 
boblarson said:
CrystalSurfer: "mm" is not the value to use for minutes. That is the designation for a two digit month. "nn" is minutes.

Jaysoul: Set the format for the text box in the properties as ShortDate. When formatting objects in Access you'll soon find out (like now) that formatting doesn't flow from one object to another (occasionally there are exceptions).

Thanks for the advice Bob...

However, what about when I want to transfer the value selected in the combo box directly into an sql query? The combo box format is set to be a short time but as soon as I move it into my sql query is appears like this: 08:30:00

I need it to be in a time format as: 00:00

I tried changing the combo box to simply be a string, which keeps the time in the right format in the sql query eg 08:30, but then I got a data type error on my sql query, I'm guessing because the data needs to be in a date/time format to draw information from a date/time field in my table?

Any help much appreciated.
Jay
 
Try this-

Put a hidden text box on the form and use code to send the time to the text box in the after update event on the combo box.
Code:
Me.txtYourTextBoxNameHere = Format(cboYourComboBoxNameHere,"hh:nn")

Then, use the text box as the criteria source for your SQL Query. Or, have your combo box display the correct short time and then have the text box show the 08:30:00 and base the query off of it so that it pulls the right data.
 

Users who are viewing this thread

Back
Top Bottom