Date Convert

G

Guest

I would like to convert a column to a date format and delete the first colum
when I import it here is the code I have for when I am importing this file

Example data

* 20051231 0.0442 0.044 0.0431

Result I would like to see

12/31/2005 0.0442 0.044 0.0431


'This would import the Current Month Data
Private Sub cmdImport_Click()
On Error GoTo ErrorCheck


varFilename = Me.txtInputFile
If IsNull(varFilename) Then
MsgBox "You must enter an input filename.", vbExclamation, " "
Me.txtInputFile.SetFocus
Exit Sub
End If

DoCmd.TransferText acImportDelim, Master, "Rate_Table_LIBOR_Swap",
varFilename, True


ErrorCheck:
Select Case Err.Number
Case 7874 'Import file not there to delete
Resume Next
Case Else
MsgBox "Error " & Err.Number & " - " & Err.Description
Exit Sub
End Select

End Sub

Thanks

Chirs
 
J

John Spencer

If you are asking how to convert the string to a date field, you could try

DateValue(Format([TheCurrentString],"@@@@/@@/@@"))

That should change the string into a date field assuming the string is in
yyyymmdd format.
 

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