Hi guys,
So I came accross this piece of code and it seems to work fine when I want to import or just view records via access..
Does anyone know if it's possible to actually have full read and write control of the tables? So that I can have forms actually running off of them?
So I came accross this piece of code and it seems to work fine when I want to import or just view records via access..
Does anyone know if it's possible to actually have full read and write control of the tables? So that I can have forms actually running off of them?
Code:
Public Function SQLServerLinkedTable()
Dim oCat As ADOX.Catalog
Dim oTable As ADOX.Table
Dim sConnString As String
' Set SQL Server connection string used in linked table.
sConnString = "ODBC;" & _
"Driver={SQL Server};" & _
"Server={172.23.165.67};" & _
"Database=BA;" & _
"Trusted_Connection=NO;" & _
"Uid=baadmin;" & _
"Pwd=redarmy#1;"
' Create and open an ADOX connection to Access database
Set oCat = New ADOX.Catalog
oCat.ActiveConnection = CurrentProject.Connection
' Create a new Table object
Set oTable = New ADOX.Table
With oTable
.Name = "mymatch"
Set .ParentCatalog = oCat
.Properties("Jet OLEDB:Create Link") = True
.Properties("Jet OLEDB:Remote Table Name") = "credit_match"
.Properties("Jet OLEDB:Cache Link Name/Password") = True
.Properties("Jet OLEDB:Link Provider String") = sConnString
End With
' Add Table object to database
oCat.Tables.Append oTable
oCat.Tables.Refresh
Set oCat = Nothing
End Function