How to get unique Record Identifiers working OK when linking Access to SQL Server
From: Dave (strategicdelivery_at_ihug.co.nz)
Date: 04/17/04
- Next message: Chuck: "Re: Access and Crystal Reports"
- Previous message: Jim: "Importing From a Specific Row"
- Next in thread: Joe Fallon: "Re: How to get unique Record Identifiers working OK when linking Access to SQL Server"
- Reply: Joe Fallon: "Re: How to get unique Record Identifiers working OK when linking Access to SQL Server"
- Messages sorted by: [ date ] [ thread ]
Date: Sun, 18 Apr 2004 09:14:59 +1200
I wish to link an Access application to a SQLServer Database by VBA and have
managed to do this. The problem I have is that the linked tables are not
updateable. If I link to the same tables via the user interface (Tools>Link
Tables etc) they are.
I think the issue is that my code does not select a unique record identifier
for the table (which you are prompted to do in the user interface). Can I
do that in VBA.
Here is my code
Private Sub PopSqlServerTbls(strAccessTbl, strDBName, strTblName,
strDataSourceName, strUserID, strPword)
Dim cat As ADOX.Catalog
Dim tbl As ADOX.Table
Set cat = New ADOX.Catalog
cat.ActiveConnection = CurrentProject.Connection
Set tbl = New ADOX.Table
tbl.Name = strAccessTbl
Set tbl.ParentCatalog = cat
tbl.Properties("Jet OLEDB:Create Link") = True
tbl.Properties("Jet OLEDB:Link Provider String") = "ODBC" & ";DATABASE=" &
strDBName & ";UID=" & strUserID & ";PWD=" & strPword & ";DSN=" &
strDataSourceName
tbl.Properties("Jet OLEDB:Remote Table Name") = strTblName
cat.Tables.Append tbl
End Sub
- Next message: Chuck: "Re: Access and Crystal Reports"
- Previous message: Jim: "Importing From a Specific Row"
- Next in thread: Joe Fallon: "Re: How to get unique Record Identifiers working OK when linking Access to SQL Server"
- Reply: Joe Fallon: "Re: How to get unique Record Identifiers working OK when linking Access to SQL Server"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|