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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inserting date in Access

Status
Not open for further replies.

jabond007

Programmer
Jun 21, 2000
39
US
hi,

I am new to access. Could somebody tell how to insert date in a table. I am getting the following date ( 09062000 ) from a text file. i need to insert it into the field (start_Date) in table APL. The date field has the short date format mm/dd/yyyy.

Could somebody give me the syntax for this insert statement.

Thanks [sig][/sig]
 
I am presuming the you have a link to the text file via an Import Specification and that the date field in the text file is a Date/Time field in the import Sepcification.

Try using the FORMAT command in an update query to change the date format.

Hope this helps... [sig]<p>Phooey<br><a href=mailto:Andrew.j.harrison@capgemini.co.uk>Andrew.j.harrison@capgemini.co.uk</a><br>Otherwise known as Windy Bottom.[/sig]
 
thanks Phooey.

What i need is the syntax to insert the following into a date field .
DAta to be inserted 09062000

I need the Access syntax for inserting date into a table

[sig][/sig]
 

what format is your date initially in???

mmddyyyy or ddmmyyyy? [sig]<p>Phooey<br><a href=mailto:Andrew.j.harrison@capgemini.co.uk>Andrew.j.harrison@capgemini.co.uk</a><br>Otherwise known as Windy Bottom.[/sig]
 
Hi!

If you by &quot;Access-syntax&quot; mean VBA, here is a sample that should do the trick;


Sub test()
Dim strsql As String

strsql = &quot;INSERT INTO APL ( fldDate ) &quot; & _
&quot;SELECT #&quot; & Format(Start_Date, &quot;Short Date&quot;) & &quot;# AS Test&quot;
DoCmd.RunSQL strsql

End Sub [sig][/sig]
 
Hi again!

A bit to quick on the wrong button;-(, sorry, this should do the trick.

Sub test()
Dim strsql As String

strsql = &quot;INSERT INTO APL ( Start_Date ) &quot; & _
&quot;SELECT #&quot; & Format( dtDateField, &quot;Short Date&quot;) & &quot;# AS Test&quot;
DoCmd.RunSQL strsql

End Sub

Roy-Vidar [sig][/sig]
 
? Format(Left(strDate, 2) & &quot;/&quot; & Mid(strdate, 3,2) & &quot;/&quot; & Right(strdate, 4), &quot;Short Date&quot;)
9/6/00
[sig]<p>MichaelRed<br><a href=mailto:mred@duvallgroup.com>mred@duvallgroup.com</a><br>There is never time to do it right but there is always time to do it over[/sig]
 
Thanks Roy and micheal...this helped me.. [sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top