M
Mohan
Hi
I am using textimport to import a large file from text into Access table
(which is working fine). Then I use DAO to select all the records just
imported (which will have last update time stamp empty) to update the time
stamp using the follwoing code: (I get invalid argument error)
Private Sub cmdImport_Extract_Click()
Dim lst_updt_time As Date
lst_updt_time = Now()
On Error GoTo ErrorCheck
DoCmd.TransferText acImportFixed, "EX_GL_DATA_SPEC", "EX_GL_data",
varfilename, False
Me.lblMessage.Caption = "Importing new data from CSV file"
Dim db2 As DAO.Database
Dim rstTrGL As DAO.Recordset
Set db2 = CurrentDb
strSQL_TRGL = "SELECT Property_Number, Property_No, Accounting_Date,
Acct_Date, Post_Amount, Post_Amount_Sign, Post_Amount2, lst_updt_timestamp
FROM EX_GL_data WHERE lst_updt_timestamp is null "
Set rstTrGL = db2.OpenRecordset(strSQL_TRGL)
If Not (rstTrGL.EOF = True Or rstTrGL.BOF = True) Then
rstTrGL.MoveFirst
End If
Do While rstTrGL.EOF = False
rstTrGL.Edit
rstTrGL!lst_updt_timestamp = lst_updt_time
rstTrGL.Update
rstTrGL.MoveNext
If rstTrGL.EOF = True Then
rstTrGL.MoveLast
Exit Do
End If
Loop
Me.lblMessage.Caption = rstTrGL.RecordCount & " - Records imported
sucessfully"
Set rstTrGL = Nothing
Set db2 = Nothing
Exit Sub
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
I am using textimport to import a large file from text into Access table
(which is working fine). Then I use DAO to select all the records just
imported (which will have last update time stamp empty) to update the time
stamp using the follwoing code: (I get invalid argument error)
Private Sub cmdImport_Extract_Click()
Dim lst_updt_time As Date
lst_updt_time = Now()
On Error GoTo ErrorCheck
DoCmd.TransferText acImportFixed, "EX_GL_DATA_SPEC", "EX_GL_data",
varfilename, False
Me.lblMessage.Caption = "Importing new data from CSV file"
Dim db2 As DAO.Database
Dim rstTrGL As DAO.Recordset
Set db2 = CurrentDb
strSQL_TRGL = "SELECT Property_Number, Property_No, Accounting_Date,
Acct_Date, Post_Amount, Post_Amount_Sign, Post_Amount2, lst_updt_timestamp
FROM EX_GL_data WHERE lst_updt_timestamp is null "
Set rstTrGL = db2.OpenRecordset(strSQL_TRGL)
If Not (rstTrGL.EOF = True Or rstTrGL.BOF = True) Then
rstTrGL.MoveFirst
End If
Do While rstTrGL.EOF = False
rstTrGL.Edit
rstTrGL!lst_updt_timestamp = lst_updt_time
rstTrGL.Update
rstTrGL.MoveNext
If rstTrGL.EOF = True Then
rstTrGL.MoveLast
Exit Do
End If
Loop
Me.lblMessage.Caption = rstTrGL.RecordCount & " - Records imported
sucessfully"
Set rstTrGL = Nothing
Set db2 = Nothing
Exit Sub
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