I have a command button on my form which opens the standard windows dialog
box and allows you to choose a file. After picking a file, the
transferspreads heet method is ran. This pulls data into a table. I then run
an append query to append this data to the end of another table. I then run
one last query, a delete query to clear the data from the first table. Here
is my code......
_______________ _______________ _______________ ____
Private Sub cmdImportWarran tyReg_Click()
Me!txtImportFil e = LaunchCD(Me)
Dim FileName1 As String
FileName1 = Me.txtImportFil e
If FileName1 = "" Then
GoTo Exit_cmdImportW arrantyReg_Clic k
End If
DoCmd.TransferS preadsheet acImport, , "Import: tblWarrantyReg" ,
FileName1, -1, "tblWarrantyReg !A1:AE2"
DoEvents
Dim stDocName3 As String
stDocName3 = "Append: tblWarrantyReg"
DoCmd.OpenQuery stDocName3, acNormal, acEdit
DoEvents
Dim stDocNameW As String
stDocNameW = "DELETE: Import: tblWarrantyReg"
DoCmd.OpenQuery stDocNameW, acNormal, acEdit
DoEvents
DoCmd.Save
DoCmd.Close
DoCmd.OpenForm "frmWarrantyReg "
DoCmd.GoToRecor d , , acLast
Exit_cmdImportW arrantyReg_Clic k:
Exit Sub
End Sub
_______________ _______________ ____________
Is there any reason why blank records would start appearing in my table.
Many times I can open my table and find blank records. The only field that
will be populated is the primary key field and sometimes a date field.
Please help. Thanks in advance.
Shannan
--
Message posted via AccessMonster.c om
box and allows you to choose a file. After picking a file, the
transferspreads heet method is ran. This pulls data into a table. I then run
an append query to append this data to the end of another table. I then run
one last query, a delete query to clear the data from the first table. Here
is my code......
_______________ _______________ _______________ ____
Private Sub cmdImportWarran tyReg_Click()
Me!txtImportFil e = LaunchCD(Me)
Dim FileName1 As String
FileName1 = Me.txtImportFil e
If FileName1 = "" Then
GoTo Exit_cmdImportW arrantyReg_Clic k
End If
DoCmd.TransferS preadsheet acImport, , "Import: tblWarrantyReg" ,
FileName1, -1, "tblWarrantyReg !A1:AE2"
DoEvents
Dim stDocName3 As String
stDocName3 = "Append: tblWarrantyReg"
DoCmd.OpenQuery stDocName3, acNormal, acEdit
DoEvents
Dim stDocNameW As String
stDocNameW = "DELETE: Import: tblWarrantyReg"
DoCmd.OpenQuery stDocNameW, acNormal, acEdit
DoEvents
DoCmd.Save
DoCmd.Close
DoCmd.OpenForm "frmWarrantyReg "
DoCmd.GoToRecor d , , acLast
Exit_cmdImportW arrantyReg_Clic k:
Exit Sub
End Sub
_______________ _______________ ____________
Is there any reason why blank records would start appearing in my table.
Many times I can open my table and find blank records. The only field that
will be populated is the primary key field and sometimes a date field.
Please help. Thanks in advance.
Shannan
--
Message posted via AccessMonster.c om
Comment