dgoulston
Hasn't Got A Clue
- Local time
- Today, 04:21
- Joined
- Jun 10, 2002
- Messages
- 403
anyone got a clue whats wrong with this code below?
----------------------------------------------------------------------------
Private Sub Command5_Click()
Dim tablename As String
Dim sourcedb As String
Dim db As Database
Dim tdf As TableDef
Set ws = DBEngine.Workspaces(0)
Set db = CurrentDb()
Set tdf = db.CreateTableDef("DNRACS")
Dim tmpnum As Integer
sourcedb = openfiledb("c:\")
tbTable.Setfocus
tablename = tbTable.text
tmpnum = (InStr(1, sourcedb, "mdb")) + 2
sourcedb = Left$(sourcedb, tmpnum)
'##sourcedb will now contain something like c:\db1.mdb##
'##tablename will containg something like "mytable"##
tdf.Connect = ";DATABASE=" & sourcedb
tdf.SourceTableName = tablename
db.TableDefs.Append tdf
End Sub
--------------------------------------------------------------------------------
any ideas?
thanks in advance
DAL
----------------------------------------------------------------------------
Private Sub Command5_Click()
Dim tablename As String
Dim sourcedb As String
Dim db As Database
Dim tdf As TableDef
Set ws = DBEngine.Workspaces(0)
Set db = CurrentDb()
Set tdf = db.CreateTableDef("DNRACS")
Dim tmpnum As Integer
sourcedb = openfiledb("c:\")
tbTable.Setfocus
tablename = tbTable.text
tmpnum = (InStr(1, sourcedb, "mdb")) + 2
sourcedb = Left$(sourcedb, tmpnum)
'##sourcedb will now contain something like c:\db1.mdb##
'##tablename will containg something like "mytable"##
tdf.Connect = ";DATABASE=" & sourcedb
tdf.SourceTableName = tablename
db.TableDefs.Append tdf
End Sub
--------------------------------------------------------------------------------
any ideas?
thanks in advance
DAL