
Importing an Access 2000 table into another Access 2000 database with VB Code
Your problem now is you've referenced the wrong DAO library. The remote
database is DAO 3.6 and you've referenced DAO 3.5 or lower
regards
Ian
** invalid email address, change dk to denmark
Tips & Tricks page http://tips.kingsoft-denmark.com/
Quote:
> Anyway, I got it straightened out, but with this code,
> Private Sub CmdImport_Click()
> Dim dbMain As Database
> Set dbMain = OpenDatabase("C:\Datac\DATA.mdb")
> dbMain.TableDefs.Delete "tblFloor"
> dbMain.Execute "SELECT * INTO tblFoor IN '" & "V:\DATA.mdb" & "' from
> tblfloor"
> End Sub
> I get an "unrecognized database format error 'C:\Datac\Data.mdb'."
> Perhaps I didn't follow your instruction exactly.
> > When I
> > Dim dbMain As Database
> > I get an error message saying
> > "User-defined type not defined"
> > I guess there's a reference I haven't loaded, but I don't know which
one.
> > > Try this
> > > Dim dbMain As Database
> > > Set dbMain = OpenDatabase(AccessFileName) 'local file
> > > dbMain.TableDefs.Delete "temp"
> > > dbMain.Execute "SELECT * INTO [temp] IN '" & <Network DB Path> _
> > > & "' FROM [temp];"
> > > regards
> > > Ian
> > > ** invalid email address, change dk to denmark
> > > Tips & Tricks page http://tips.kingsoft-denmark.com/
> > > > I have the VB code to use dir1 listboxes to browse through the
network
> > for
> > > > all .mdb files.
> > > > When the user selects an access 2000 database in the file1 VB box,
> > > > I would like the table within the database (and there's only one
> table -
> > > > we'll call it "temp") selected in the file1 VB box copied to the
> > database
> > > > on the local hard drive. The name of the table ("temp"), will
always
> > be
> > > > the same,
> > > > even though the names of the databases on the network will differ.
> > > > The code so far:
> > > > Dim dbMain As Database
> > > > Dim rsMain As Recordset
> > > > Set dbMain = OpenDatabase(AccessFileName) 'Database on network
> > > > selected in file1 VB box containing table "temp"
> > > > On Error Resume Next
> > > > dbMain.Execute "CREATE TABLE " & AccessTableName ;" 'temp
> > > > Set rsMain = dbMain.OpenRecordset(AccessTableName) 'database
on
> > > local
> > > > hard drive
> > > > Now I have to copy the table into the database on the local hard
> drive,
> > > > overwriting the existing table called "temp".
> > > > Doesn't matter that the local table is overwritten, the data in that
> > table
> > > > is done with.
> > > > What's next?