Database syntax error

C

CaptDD

I have a database that stores time in military short format. The input mast
for the data field on the data entry form is 00:00;0;_ If I enter a time
such as 06:35 the form accepts the data and puts it into the database.

Now the issue, when the time is saved in the database it drops the leading 0
(zero) storing it as 6:35. I have a duplicate record button on my form that
works only when the time saved contains four numbers such as 15:35. Any data
with time saved as above which was entered with a leading zero brings an
error message that the data entered does not match the input mask.

How do I get the database to hold the leading 0 (zero)? Or, how do I change
the imput mask so that it may or may not have the leading 0 (zero)?
 
S

Stefan Hoffmann

hi,

I have a database that stores time in military short format. The input mast
for the data field on the data entry form is 00:00;0;_ If I enter a time
such as 06:35 the form accepts the data and puts it into the database.
A time value stored in a Date/Time field is always stored as a
combination of a date value and a time value. A display mask may format
the values.

In what kind of field are you storing your time?
How do I get the database to hold the leading 0 (zero)? Or, how do I change
the imput mask so that it may or may not have the leading 0 (zero)?
Take a look at

http://office.microsoft.com/en-us/access/HA100964521033.aspx#2

Using 90:00;0;_ should work.


mfG
--> stefan <--
 
J

John W. Vinson

I have a database that stores time in military short format.

Well... no, it actually doesn't.

It *STORES* the time as a Double Float number, a count of days and fractions
of a day since midnight, December 30, 1899. If you put 06:00 into the field,
what is stored internally is 0.25000000000000000 or thereabouts.

The *DISPLAY* of that value depends on the Format and Input Mask properties.

The exception would be if you're storing the time in a Text field, in which
case it could be anything you like... but you might have real trouble doing
time calculations with it.
The input mast
for the data field on the data entry form is 00:00;0;_ If I enter a time
such as 06:35 the form accepts the data and puts it into the database.

Now the issue, when the time is saved in the database it drops the leading 0
(zero) storing it as 6:35. I have a duplicate record button on my form that
works only when the time saved contains four numbers such as 15:35. Any data
with time saved as above which was entered with a leading zero brings an
error message that the data entered does not match the input mask.

How do I get the database to hold the leading 0 (zero)? Or, how do I change
the imput mask so that it may or may not have the leading 0 (zero)?

90:00 will make the leading zero optional. A Format property of "hh:nn" should
display the leading zero.
 

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