Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / March 2008

Tip: Looking for answers? Try searching our database.

Time field continues to show date

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Penstar - 13 Mar 2008 02:27 GMT
I have a time field which I have formatted to medium time eg 07:00 AM.  This
is OK until you click on it to edit the time, when the date continues to
popup.

In the time control's "on enter", "on click" and "before update" events I
have set     Me.time = Format(Me.time, "hh:nn"). This prevents the time from
showing the date/time.

However, the date/time continues to flick up every time you click on the
field to change the time.  It is driving me mad!

Is there any way to fix this?
Rick Brandt - 13 Mar 2008 02:39 GMT
> I have a time field which I have formatted to medium time eg 07:00
> AM.  This is OK until you click on it to edit the time, when the date
[quoted text clipped - 8 lines]
>
> Is there any way to fix this?

DateTime fields in Access always have a date.  If you don't see it then it
is 12/30/1899.  It is only formatting that hides this from you and that is
disabled when the control has focus.  Access has no "Time" field although
some other database engines do.  I believe an InputMask would solve that
issue.

Otherwise you could hide your bound control and provide an unbound TextBox
for editing that would just accept the time which you would then copy to the
hidden control in the BeforeUpdate event.

Signature

Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt   at   Hunter   dot   com

Penstar - 13 Mar 2008 11:10 GMT
Thank you for your suggestion.  I used an unbound textbox and it worked.

> > I have a time field which I have formatted to medium time eg 07:00
> > AM.  This is OK until you click on it to edit the time, when the date
[quoted text clipped - 18 lines]
> for editing that would just accept the time which you would then copy to the
> hidden control in the BeforeUpdate event.
Allen Browne - 13 Mar 2008 02:46 GMT
Setting the Format property affects only what is *displayed*, i.e. it masks
(but does not change) what the field really contains.

If you want to strip the date from the field, you could use an Update query
to do that.

1. In query design view, choose Update on the query menu.
Access adds an Update row to the design grid.

2. In the Update row under your time field, enter:
   TimeValue([Time])

3. Run the query.

That solves the existing records. You will want to figure out how the date
part got into the field so the problem does not keep recurring.

BTW, TIME is a reserved word in JET SQL, and also in VBA where Access may
understand it for the current time. If that really is your field name, you
may want to change it. Here's a reference list of the field names that can
cause you grief:
   http://allenbrowne.com/AppIssueBadWord.html

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

>I have a time field which I have formatted to medium time eg 07:00 AM.
>This
[quoted text clipped - 10 lines]
>
> Is there any way to fix this?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.