Hi,
I would like to create a link table in MS Access to a SQLite database. (Not
using ODBC driver)
The following code works in MS Access, but link table are in another MS
Acces database
Private Sub CreateAccessLinkTable(ByVal stmtHandle As Long, newTableName As
String)
Dim td As DAO.TableDef
Dim colCount As Long
Dim colValue As Variant
Dim i As Long
Dim dbsCurrent As DAO.Database
Dim tdf As DAO.TableDef
Dim strConnect As String
Dim strDbFile As String
Dim strLinkName As String
Dim strPassword As String
Dim strSourceTableName As String
strDbFile = "C:\Test\Data.mdb"
strSourceTableName = "authorizationActions"
strLinkName = "authorizationActions"
strConnect = "MS Access" & _
";DATABASE=" & strDbFile
Set dbsCurrent = CurrentDb
Set tdf = dbsCurrent.CreateTableDef
tdf.Connect = strConnect
tdf.SourceTableName = strSourceTableName
tdf.Name = strLinkName
dbsCurrent.TableDefs.Append tdf
End Sub
I would like to do the same, but I'm missing the connection string for the
(Dim td As DAO.TableDef) td.Connect - for the SQLite connection.
Private Sub CreateLocalLinkTable(ByVal stmtHandle As Long, newTableName As
String)
Dim td As DAO.TableDef
Dim colCount As Long
Dim colValue As Variant
Dim i As Long
Dim dbsCurrent As DAO.Database
If myDbHandle = 0 Then Err.Raise 99, , "database not open"
colCount = SQLite3ColumnCount(stmtHandle)
' Create Table
Set dbsCurrent = CurrentDb
Set td = dbsCurrent.CreateTableDef
td.Connect = ?????????????????????????????????????????? (Not with ODBC
- must be from SQLite.DLL)
td.SourceTableName = newTableName
td.Name = newTableName
dbsCurrent.TableDefs.Append td
End Sub