MS Access front end see no linked tabled from SQL backend? - ms-access

I created an Access database (back end) and linked lots of tables to my SQL Server.
I created a second Access database (front end) and when I try to link to the linked sql tables from the first (back end) database, the list shows up empty - no linked table.
Can't I have a back end Access db with linked SQL tables and then access them from a front end Access database (as linked)?

Short answer: No.
From your second database, you will have to link the tables you need from SQL Server.

Related

MS Access Link to Linked Tables in another databse [duplicate]

My scenario: Computer A has an Access database that contains linked tables. Those linked tables actually reside in another Access database on Computer B. Nothing unusual yet.
Now we create a SQL Server database, and establish links to those tables in the Access database on Computer B; we configure a Machine DSN to define the necessary ODBC connection on Computer B. Access database B now contains both local tables and linked SQL tables.
Access database A now wants to link to Access database B's new tables -- but only its local tables show up in the dialog to add a linked table. It appears that you can't "link to a linked table" in Access...
But is this actually true? What we want to do is present database B's SQL table links to database A as if they were local tables; i.e. database A is not aware that the new tables in database B are not actually local.
Of course, we could link the SQL tables directly into database A by configuring a DSN on that computer, but we don't want to do this. We would like to use computer/database B as a nexus or "gateway" that presents both local and SQL tables seamlessly to other Access client applications on the network. This is only a temporary setup that would allow us to gradually migrate all Access client apps to SQL Server-based tables, without having to modify a lot of code.
Can this be done? Is there another workable solution or scenario we haven't thought of?
Nope - you can only link to real tables - you have to recreate the SQL server links you did on database B for database A
If the SQL server data does not change much and you are just using it for lookups you could import the data into real Access tables which you could link to.
EDIT
Another solution is to link the tables dynamically - that way you don't have to add the DSN manually to each computer. Use a connection string something like this:
ODBC;Driver={SQL Server};Server=<server name/IP>;Database=<database>;UID=<user>;PWD=<password>
This links a table
Dim db As Database
Dim TD As TableDef
Dim sTableName As String ''MS Access name (can be same as SQL Server name)
Dim sServerTableName As String ''SQL Server Name
sTable = "Table1"
sServerTableName = "dbo.Table1"
sServerConnect = "ODBC;Driver={SQL Server};Server=Localhost;Database=DB1;"
Set TD = db.CreateTableDef(sTableName)
TD.Connect = sServerConnect
TD.SourceTableName = sServerTableName
db.TableDefs.Append TD
db.TableDefs.Refresh
In regard to the query suggestion, it's possible to use an IN 'C:\OtherDatabase.mdb' clause in a FROM clause:
SELECT qryMyTable.*
FROM qryMyTable IN 'c:\OtherDatabase.mdb';
This will display for you in the database where the query is stored the contents of the query in the other database. If that path to the other database doesn't change, you could use this method to piggyback on that other database's linked tables.
Could you create a query/view on B that is just a view of the linked table on C, so that A can then access the query/view on B (which is actually the table on C)?
like:
Linked Query on A -> Query on B
:
Linked table on B -> Real table on C
edit after comment: OK, apparently you can't link to Queries, so that won't work then.
One other idea: Can you set up Replication between B and C so that all of C's tables are replicated to B, where A can access them?

Joinning SQL Server table with *.mdb file

I'm trying to joinning SQLServer 2008 R2 tables with msaccess table (*.mdb).
I already tried "OPENDATASOURCE" and "Linked Server", but no one of them is work correctly.
in example, I've got the following message:
OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server
"TestLinkServer" returned message "Cannot open database ''. It may
not be a database that your application recognizes, or the file may be
corrupt.".
the other error message:
OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "MDBTest"
returned message "The Microsoft Jet database engine cannot open the
file '\10.55.56.34\Shared Folder\LBUS.mdb'. It is already opened
exclusively by another user, or you need permission to view its
data.".
and many more :D
can anyone give the working tutorial?
thanks in advance.. :)
The easiest way is to do the join inside ms-access.
Set up a table link in your access database that references the sql-server table you want to join.
Then build a query in access that joins that table with one or more tables in the access database.
If you want to join more than one sql-server table, first create a view in sql-server that combines all the relevant tables. Then set up your table link to reference the view.
If, for some reason, you must do the join inside SQL server, you will have to use a different technique, or use the table link feature to "push" data from the access table to a (previously defined) sql server table. Then, it's just an ordinary join.

SQL Server : set user to only SEE 1 database, and only some views. (not just deny access, so they can't see at all)

I'm trying to set up a user in SQL Server 2008 R2 so when they login, they only see one database and so they only see views with 1 schema.
They should not be able to see that other databases exist, that any tables exist within the database that they can see, or any views that exist other than tables that belong to one schema.
How can I go about doing this?
Thank you in advance
Edit: some more information. I have managed to get a user to only see 1 database and no others in the past by denying view all databases and making the user the owner of the database. In this case the user can not be the owner of the database.
You can move the database to a new instance.

MS-Access Add Additional Linked Tables

I have an MS-Access database that was converted to use SQL Tables using the "Microsoft SQL Server Migration Assistant 2008 for Access" (aka SSMA) and created linked tables (so the MS-Access interface still works but is linked to SQL Tables).
Modifying those tables has been no problem (modify in SQL, use the Linked Table Manager in MS-Access, update tables). But I've not added a new table in SQL and I can't find a way to add that table to the set of linked tables.
I've tried the External Data -> ODBC Database, but it wants me to make a FileDSN and since the SSMA tool didn't require that I don't want to have some tables linked one way and other files liked another way (does anyone know how SSMA links the tables?).
So my underlying question is: Without using DSN how do I add an additional SQL Server table to MS-Access as a linked table?

How do I "chain" linked tables in Access?

My scenario: Computer A has an Access database that contains linked tables. Those linked tables actually reside in another Access database on Computer B. Nothing unusual yet.
Now we create a SQL Server database, and establish links to those tables in the Access database on Computer B; we configure a Machine DSN to define the necessary ODBC connection on Computer B. Access database B now contains both local tables and linked SQL tables.
Access database A now wants to link to Access database B's new tables -- but only its local tables show up in the dialog to add a linked table. It appears that you can't "link to a linked table" in Access...
But is this actually true? What we want to do is present database B's SQL table links to database A as if they were local tables; i.e. database A is not aware that the new tables in database B are not actually local.
Of course, we could link the SQL tables directly into database A by configuring a DSN on that computer, but we don't want to do this. We would like to use computer/database B as a nexus or "gateway" that presents both local and SQL tables seamlessly to other Access client applications on the network. This is only a temporary setup that would allow us to gradually migrate all Access client apps to SQL Server-based tables, without having to modify a lot of code.
Can this be done? Is there another workable solution or scenario we haven't thought of?
Nope - you can only link to real tables - you have to recreate the SQL server links you did on database B for database A
If the SQL server data does not change much and you are just using it for lookups you could import the data into real Access tables which you could link to.
EDIT
Another solution is to link the tables dynamically - that way you don't have to add the DSN manually to each computer. Use a connection string something like this:
ODBC;Driver={SQL Server};Server=<server name/IP>;Database=<database>;UID=<user>;PWD=<password>
This links a table
Dim db As Database
Dim TD As TableDef
Dim sTableName As String ''MS Access name (can be same as SQL Server name)
Dim sServerTableName As String ''SQL Server Name
sTable = "Table1"
sServerTableName = "dbo.Table1"
sServerConnect = "ODBC;Driver={SQL Server};Server=Localhost;Database=DB1;"
Set TD = db.CreateTableDef(sTableName)
TD.Connect = sServerConnect
TD.SourceTableName = sServerTableName
db.TableDefs.Append TD
db.TableDefs.Refresh
In regard to the query suggestion, it's possible to use an IN 'C:\OtherDatabase.mdb' clause in a FROM clause:
SELECT qryMyTable.*
FROM qryMyTable IN 'c:\OtherDatabase.mdb';
This will display for you in the database where the query is stored the contents of the query in the other database. If that path to the other database doesn't change, you could use this method to piggyback on that other database's linked tables.
Could you create a query/view on B that is just a view of the linked table on C, so that A can then access the query/view on B (which is actually the table on C)?
like:
Linked Query on A -> Query on B
:
Linked table on B -> Real table on C
edit after comment: OK, apparently you can't link to Queries, so that won't work then.
One other idea: Can you set up Replication between B and C so that all of C's tables are replicated to B, where A can access them?