UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Link Table In Access runtime    
 
   
sandrao
post Aug 13 2010, 07:53 AM
Post #1

UtterAccess Guru
Posts: 559
From: Montreal, QC



I packaged a db in Access Runtime 2007 and in my ribbon I created the Link Table option

<button idMso="DatabaseLinedTableManager" size="large" visible="true" label="Link Tables"

However when I tested the db in Access Runtime the Link Table option hindered my ribbon from opening.

I know this because I went and packaged it again without this option and everything ran fine.

MY QUESTION?

Is ther another way to have it included in a package e.g. vb that will not cause errors?



sandrao
Go to the top of the page
 
+
Scott McDaniel
post Aug 14 2010, 05:00 AM
Post #2

UtterAccess VIP
Posts: 569
From: North Augusta, SC



The Linked Table Manager won't function in the Runtime. You'll need to provide your own interface to allow users to relink their tables.

UA WIKI Table Relink

Relink utility from Dev's Access Web

Relink code from Fabalou's website - very simple example to get you started


--------------------
Go to the top of the page
 
+
sandrao
post Aug 14 2010, 02:50 PM
Post #3

UtterAccess Guru
Posts: 559
From: Montreal, QC



the code works find to relind the be However when I tried to suggest another be end this part of the code caused an error

Function fGetMDBName(strIn As String) As String
'Calls GetOpenFileName dialog
Dim strFilter As String

strFilter = ahtAddFilterItem(strFilter, _
"Access Database(*.mdb;*.mda;*.mde;*.mdw) ", _
"*.mdb; *.mda; *.mde; *.mdw")
strFilter = ahtAddFilterItem(strFilter, _
"All Files (*.*)", _
"*.*")

fGetMDBName = ahtCommonFileOpenSave(Filter:=strFilter, _
OpenFile:=True, _
DialogTitle:=strIn, _
Flags:=ahtOFN_HIDEREADONLY)
End Function


Because I am using Access 2007 how do I include .accdb in the string.
Go to the top of the page
 
+
Scott McDaniel
post Aug 14 2010, 03:08 PM
Post #4

UtterAccess VIP
Posts: 569
From: North Augusta, SC



What was the error?

To include the .accdb extension:

strFilter = ahtAddFilterItem(strFilter, _
"Access Database(*.mdb;*.mda;*.mde;*.mdw;*.accdb) ", _
"*.mdb; *.mda; *.mde; *.mdw;*.accdb")

strFilter = ahtAddFilterItem(strFilter, _
"All Files (*.*)", _
"*.*")


--------------------
Go to the top of the page
 
+
sandrao
post Aug 14 2010, 03:52 PM
Post #5

UtterAccess Guru
Posts: 559
From: Montreal, QC



the error was Compile error
Sub or function not defined

strFilter = ahtAddFilterItem(strFilter, _

was highlighted.

While I am at it I tried using

'RelinkTables...Just as the name suggests pass a path to a database to this sub
'eg RelinkTables("CurrentProject.path & "\pmtgdb.accdb")

‘c:\windows\test.mdb")
'and it will go through all the tables in your
'database and link them to the new location
'Written by John Hawkins 20/9/99 www.fabalou.com
Public Sub RelinkTables(NewPathname As String)
Dim Dbs As Database
Dim Tdf As TableDef
Dim Tdfs As TableDefs
Set Dbs = CurrentDb
Set Tdfs = Dbs.TableDefs
'Loop through the tables collection
For Each Tdf In Tdfs
If Tdf.SourceTableName <> "" Then 'If the table source is other than a base table
Tdf.Connect = ";DATABASE=" & NewPathname 'Set the new source
Tdf.RefreshLink 'Refresh the link
End If
Next 'Goto next table
End Sub


Tried to use =RelinkTables ("CurrentProject.path & "\pmtgdb.accdb")
in OnClick Event but that didn't work.

I tested the two links that you give to see which I could use.
Go to the top of the page
 
+
Scott McDaniel
post Aug 14 2010, 04:35 PM
Post #6

UtterAccess VIP
Posts: 569
From: North Augusta, SC



To use the code at the Access Web, you must also use the GetOpenFileName modules (http://www.mvps.org/access/api/api0001.htm). If you'd like to use that, then please carefully read the instructions at the top and follow them exactly.


--------------------
Go to the top of the page
 
+
sandrao
post Aug 14 2010, 06:14 PM
Post #7

UtterAccess Guru
Posts: 559
From: Montreal, QC



I'm sorry for getting you on the wrong direction.

I am interested in using the small "RelinkTables(NewPathname As String).

I don't really need to look for the BE in other locations. When I package the DB the FE and the BE will all be and same folder.

I am not just sure how the small RelinkTables is triggered.

I used the on click event but I think there is something wrong with string.

Tried to use =RelinkTables ("CurrentProject.path & "\pmtgdb.accdb")

Perhaps it should be placed in a Public Function? I am just not sure how the example is used

c:\windows\test.mdb") this is my path C:\Users\WAYNE\Documents\PMdb\pmtgdb.accdb

I have used the idea of CurrentProject.path because when the db is used by others it is the easiest way to referr to the path.

I am not sure where to how to employ the path and how to trigger it.
Go to the top of the page
 
+
Scott McDaniel
post Aug 14 2010, 06:19 PM
Post #8

UtterAccess VIP
Posts: 569
From: North Augusta, SC



I don't think you finished your reply. Can you review and repost?


--------------------
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Search  ·  Go to Top  ·  Lo-Fi Version Time is now: 23rd July 2014 - 12:54 PM