W
Wayne-I-M
Hi All
Is it possible to restrict the number of records imported from an external
DB table to an internal table. At the moment the append query has a simple
thinking this is a little combersom. Is it possible to restrict the import
itself - maybe not but ...
This is the standard code for importing from an external table which I use
quite a bit - as you can see it simply imports all records into a temp table
then via an append writes these to the main table (> timestamp - not shown
here)
Private Sub ButtonName_Click()
Dim IMPfile As TableDef
For Each IMPfile In CurrentDb.TableDefs
If IMPfile.Name = "SomeTempTable" Then
CurrentDb.TableDefs.Delete IMPfile.Name
End If
Next
DoCmd.TransferDatabase acImport, "Path to external DB.mdb", acTable,
"ExternalTableName", "SomeTempTable"
DoCmd.SetWarnings False
DoCmd.OpenQuery "SomeAppendQuery"
DoCmd.SetWarnings True
CurrentDb.TableDefs.Delete "SomeTempTable"
End Sub
Many thanks
Is it possible to restrict the number of records imported from an external
DB table to an internal table. At the moment the append query has a simple
table to give the message box - you are importing # records, etc) - but wasDateStamp criteria which works fine (the append also writes to another temp
thinking this is a little combersom. Is it possible to restrict the import
itself - maybe not but ...
This is the standard code for importing from an external table which I use
quite a bit - as you can see it simply imports all records into a temp table
then via an append writes these to the main table (> timestamp - not shown
here)
Private Sub ButtonName_Click()
Dim IMPfile As TableDef
For Each IMPfile In CurrentDb.TableDefs
If IMPfile.Name = "SomeTempTable" Then
CurrentDb.TableDefs.Delete IMPfile.Name
End If
Next
DoCmd.TransferDatabase acImport, "Path to external DB.mdb", acTable,
"ExternalTableName", "SomeTempTable"
DoCmd.SetWarnings False
DoCmd.OpenQuery "SomeAppendQuery"
DoCmd.SetWarnings True
CurrentDb.TableDefs.Delete "SomeTempTable"
End Sub
Many thanks