Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Time Format

Status
Not open for further replies.

Denyson

Programmer
Mar 20, 2001
19
BR
Hello,

I'm running a make table query that creates a new table with a field called "HorarioChamada" with type Date/Time and with the Date and the time. I only need the time. Is it possible input by VBA the format ShortTime to this field to keep only with the Time?
How is the best way to do this in runtime?

Thanks
Denyson
 
Where is the source of the data that you are adding to the table? If the time is entered on a form, set the property for that field to Short Time and you should be good to go. You should also set the format in the table to Short Time as you noted.
 
I want to know if I can set the format to Short time in VBA Code?
 
Yes, it is possible to do this in code but to do so, as far as I can tell, you have to run a pre-defined query. If you design a query in Access, make it a Maketable query, add the fields you want to put into the new table, then right-click the field in the grid that you want to be the time field. This will give you the property sheet for the field and you can set the format property to Short Time, which will use the short time format that is set up on the computer that the database is running on.

You can then run this query using the RunSQL method. Go to SQL view of the query to copy and paste the SQL to be run into VBA. Have fun! :eek:)

Alex Middleton
 
I must set the format of the table in VBA Code... Is it not possible?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top