By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,154 Members | 2,313 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,154 IT Pros & Developers. It's quick & easy.

Time portion displayed when field has the focus

P: n/a
Using Access2K...
I have a field StartDate
The format is set to "Short Date". Sure enough, it diplays
"01/30/2004" etc.
Except, if a user clicks the field, the time portion 12:00:00 AM shows
until the field loses the focus. Is there a way to prevent the time
portion from showing?
Thanks
lq
Nov 12 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Do you have an Input Mask than may be causing this?

--
Wayne Morgan
Microsoft Access MVP
"Lauren Quantrell" <la*************@hotmail.com> wrote in message
news:47**************************@posting.google.c om...
Using Access2K...
I have a field StartDate
The format is set to "Short Date". Sure enough, it diplays
"01/30/2004" etc.
Except, if a user clicks the field, the time portion 12:00:00 AM shows
until the field loses the focus. Is there a way to prevent the time
portion from showing?
Thanks
lq

Nov 12 '05 #2

P: n/a
It depends on your data. If you set the format property for the table
to "Short Date" and the format property of the Text box to "Short
Date" but then default or enter the data with a time component, the
time component will be displayed when you enter the field.

Use Date() rather than Now() for the default or remove the time
component in the AfterUpdate event of the field. The following code
seems to work by stripping off the time component or fraction part of
the underlying value.

Private Sub TestDate1_AfterUpdate()
'Remove the time component from the value entered
TestDate1.Value = CDate(Int(TestDate1.Value))
End Sub

There are lots of posts in this news group regarding format and "Short
Date". Take some time to browse them - you'll learn heaps. This has
been answered before.
Nov 12 '05 #3

P: n/a
Thanks for the response.
I'm using no input mask. I have a smalldatetime column (SQL Server
backend) and I need to store date AND time in it. I convert it all to
GMT depending on where the user is, an the table cotains tens of
thousands of records.
Sometimes I need to display it only as a date and drop off the time.
That's where I have the problem with Access showing the time anyway
when the field has the focus.
lq

"Wayne Morgan" <co***************************@hotmail.com> wrote in message news:<Zb******************@newssvr16.news.prodigy. com>...
Do you have an Input Mask than may be causing this?

--
Wayne Morgan
Microsoft Access MVP
"Lauren Quantrell" <la*************@hotmail.com> wrote in message
news:47**************************@posting.google.c om...
Using Access2K...
I have a field StartDate
The format is set to "Short Date". Sure enough, it diplays
"01/30/2004" etc.
Except, if a user clicks the field, the time portion 12:00:00 AM shows
until the field loses the focus. Is there a way to prevent the time
portion from showing?
Thanks
lq

Nov 12 '05 #4

P: n/a
"Lauren Quantrell" <la*************@hotmail.com> wrote in message
news:47**************************@posting.google.c om...
Thanks for the response.
I'm using no input mask. I have a smalldatetime column (SQL Server
backend) and I need to store date AND time in it. I convert it all to
GMT depending on where the user is, an the table cotains tens of
thousands of records.
Sometimes I need to display it only as a date and drop off the time.
That's where I have the problem with Access showing the time anyway
when the field has the focus.


If you use the format property this is the normal behavior. Display only uses
the format property until the control has focus at which point you see the
actual stored data. If the user does not need to edit the field you can use the
Format Function instead of the format property. If they do need to edit it then
you would have to use a mask. This would set the time back to midnight whenever
they edited the control though.
--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Nov 12 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.