How to inherit relationships in link MDB with password

F

Frank Dulk

I possess a separate system in FE/BE.
To link the tables, I use the procedure to proceed:

Sub Revincula()
Dim strConn As String, strBE As String
Dim tbl As Object

strBE = "SeuBE.MDB"

strBE = CurrentProject.Path & "\" & strBE
strConn = ";DATABASE=" & strBE

If Len(Dir(strBE) & "") = 0 Then Exit Sub

For Each tbl In CurrentDb.TableDefs
If Left(tbl.Name, 4) <> "MSys" _
And tbl.Connect <> strConn Then
tbl.Connect = strConn
tbl.RefreshLink
End If
Next
End Sub
I inserted password in Back-End and I started to use the code below:

Sub Revincula()
Dim strConn As String, strBE As String, strPwd As String
Dim tbl As Object

strBE = "SeuBE.MDB"
strPwd = "suasenha"

strBE = CurrentProject.Path & "\" & strBE
strConn = "MS Access;PWD=" & strPwd & ";DATABASE=" & strBE

If Len(Dir(strBE) & "") = 0 Then Exit Sub

For Each tbl In CurrentDb.TableDefs
If Left(tbl.Name, 4) <> "MSys" _
And tbl.Connect <> strConn Then
tbl.Connect = strConn
tbl.RefreshLink
End If
Next
End Sub
However I observed that when linking the tables of BE with password, the
relationships are not inherited.
How to outline this problem?
At once I thank.
 
M

Marshall Barton

Frank said:
I possess a separate system in FE/BE.
To link the tables, I use the procedure to proceed:

Sub Revincula()
Dim strConn As String, strBE As String
Dim tbl As Object

strBE = "SeuBE.MDB"

strBE = CurrentProject.Path & "\" & strBE
strConn = ";DATABASE=" & strBE

If Len(Dir(strBE) & "") = 0 Then Exit Sub

For Each tbl In CurrentDb.TableDefs
If Left(tbl.Name, 4) <> "MSys" _
And tbl.Connect <> strConn Then
tbl.Connect = strConn
tbl.RefreshLink
End If
Next
End Sub
I inserted password in Back-End and I started to use the code below:

Sub Revincula()
Dim strConn As String, strBE As String, strPwd As String
Dim tbl As Object

strBE = "SeuBE.MDB"
strPwd = "suasenha"

strBE = CurrentProject.Path & "\" & strBE
strConn = "MS Access;PWD=" & strPwd & ";DATABASE=" & strBE

If Len(Dir(strBE) & "") = 0 Then Exit Sub

For Each tbl In CurrentDb.TableDefs
If Left(tbl.Name, 4) <> "MSys" _
And tbl.Connect <> strConn Then
tbl.Connect = strConn
tbl.RefreshLink
End If
Next
End Sub
However I observed that when linking the tables of BE with password, the
relationships are not inherited.
How to outline this problem?


What do you expect?

The relationships are in the back end mdb and linking to the
back end tables will not affect the relationships.

Relationships in the front end do not have any purpose
except to serve as default joins when you create a new
query.

In other words, the only relationships that have meaning are
the back end relationships, so there is no such thing as
inheriting relationships.
 
F

Frank Dulk

Thank you for the attention.
I tried, without success, the use of the method CreateRelation, basing on
Relation of BE.
I believe that the method is not applied to linked tables.
 
M

Marshall Barton

That's correct. Relationships only apply in the same
database with the real tables.

Whatever your objective, you can not achieve it using
relationships anywhere except the back end db.
 
F

Frank Dulk

thank you

Marshall Barton said:
That's correct. Relationships only apply in the same
database with the real tables.

Whatever your objective, you can not achieve it using
relationships anywhere except the back end db.
--
Marsh
MVP [MS Access]


Frank said:
Thank you for the attention.
I tried, without success, the use of the method CreateRelation, basing on
Relation of BE.
I believe that the method is not applied to linked tables.


"Marshall Barton" escreveu
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top