DataBase - Refresh links in ACCDE
Asked By Francois Houde
21-Oct-09 01:31 PM

Hi everybody, I have a problem with the code below. It works fine when it is
in a accdb but when I create an ACCDE it does not work. Any idea on how to
solve this issue ? I am trying to connect to a different sql database (test,
pre-production, production depending on which one the user want to access)
Thanks in advance
Fran??ois Houde
Dim rVersion As String
Dim rConnect As String
Dim TableDef As Object
rVersion = WhichVersion()
Me.Caption = Trim(Me.Caption) & " (" & rVersion & ")"
If rVersion = "Pre-production" Then
rConnect = "ODBC;DSN=DSN_PreProd;Description=DSN_PreProd;APP=2007
Microsoft Office system;DATABASE=PreProd;Trusted_Connection=Yes"
End If
If rVersion = "Production" Then
rConnect =
system;DATABASE=Production;Trusted_Connection=Yes"
End If
If rVersion = "Test" Then
rConnect = "ODBC;DSN=DSN_Test;Description=DSN_Test;APP=2007
Microsoft Office system;DATABASE=Test;Trusted_Connection=Yes"
End If
For Each TableDef In CurrentDb.TableDefs
If TableDef.Connect <> "" Then
TableDef.Connect = rConnect
TableDef.Refreshlink
End If
Next
CurrentDb.TableDefs
(1)
Office
(1)
TableDef.Refreshlink
(1)
TableDef.Connect
(1)
Database
(1)
DougSteele
(1)
PreProd
(1)
RConnect
(1)
Douglas J. Steele replied to Francois Houde
What happens when you try? Do you get an error message? If so, what is the
error message?
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
AccessVandal via AccessMonster.com replied to Francois Houde
I see a problem with reserved name "TableDef" and you had declared it as an
object. Shouldn't it be
Dim oTdf As TableDef
Don't forget to destroy or close it.
--
Please Rate the posting if helps you.
Message posted via http://www.accessmonster.com
Francois Houde replied to Francois Houde
Don't know why, but I compile the vba Code, compact the database and the
recreate the ACCDE. Then It Worked fine.
Thanks all
Tony Toews [MVP] replied to AccessVandal via AccessMonster.com
Good catch.
Tony
--
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
For a free, convenient utility to keep your users FEs and other files
updated see http://www.autofeupdater.com/
Granite Fleet Manager http://www.granitefleet.com/

Library Database DataBase Firstly, I am not sure if Library database is the correct term. I am talking about Dbs to which you set a reference drew blanks last time. Now assuming I have several referenced (library?) databases in my main database, how do I get the names of all the forms in all the Dbs? CodeProject AllForms.Count gives me the correct number of forms if I am in that referenced database. What I think I need is a method of looping through all the different CodeProject names in the main database, but there is not a sort of CodeProjects parent object. Or somehow moving the focus are. Any help gratefully received Phil Access Discussions David W. Fenton (1) Access 2007 (1) Office 2007 (1) Windows 7 (1) Distributed (1) Exception (1) Relative (1) Declare (1) Library is And, No, there is not any parent object for all the code projects. Because each database only knows about its own objects (or documents), you have to use a procedure in
Might be outgrowing Access but daunted by SQL Server DataBase I am close to completing the consolidation of various small Access databases and a couple of Excel spreadsheets that my little company uses (5 staff) into an all encompasing Access database and I was planning on splitting the database when I was finished to allow simaltaneous use of it by staff on our small office network. However it is becoming more and more obvious to me that I am going to need to give staff access to this new database from remote locations (outside of our office network). Two staff members are regularly overseas, one is mainly on the road with her been playing around with trying to link tables from remote locations (ftp path of the database on our Network Storage Device at the office) and needless to say - that do not work. So I have spent the last 10
2010: Essential Diffs? DataBase Sounds like Access 2010 is something of a different animal from preceding versions. Could anybody Virtual PC (1) Windows XP (1) Visual Studio 2010 (1) SharePoint (1) Access 2010 (1) Office 2010 (1) Access 2007 (1) One starting point would be to browse Access team's version of VBA of course is also runs on the 32 bit version of windows. -> Database triggers and stored procedures: New for 2010 in jet is table events and table stored value. Now one can argue that these aggregate totals should never be stored in the database. Fact of the matter is a lot of times it is REALLY handy to do in figuring it all out: Compatibility Between the 32-bit and 64-bit Versions of Office 2010 http: / / msdn.microsoft.com / en-us / library / ee691831(office.14).aspx GPG on Access: A work in Progress and 64 Bit VBA http: / / tinyurl http: / / gpgonaccess.blogspot.com / 2010 / 03 / work-in-progress-and-64-bit-v ba.html Office 2010 - about the 64-bit version - Office Watch http: / / news.office-watch.com / t / n.aspx?a = 1403 Installing Office 2010 64
error during loading dll DataBase Hello, I am faced with a strange problem. I have an Access2003 application with a routine to connect tables in external mdb's. Dim tdf as TableDef Set tdf = CurrentDb.TableDefs since a few days this command produces an error on _one_ computer The code worked the problem: - checked references - created new mdb and imported all objects - replaced CurrentDb by a Database variable - compress / repair - installation / repair - deinstalled and re-installed Office - sfc / scannow . . .but of no avail. any ideas? Os is Windows 7. thanx for your help, Helmut Access Discussions Windows 7 (1) Office (1) Routine (1) Helmut Blass (1) TableDefs (1) CurrentDb (1) Database (1) Print (1) I do not understand how it could be working on any machine You must indicate which table you want, using one of the following approaches: Set tdf = CurrentDb.TableDefs(0) Set tdf = CurrentDb.TableDefs("NameOfTable") Hello, I am faced with a strange problem
Anzeige eines Wertes im Formular aus einer for next Schleife DataBase Hallo NG, ich habe hier einen h = FCbschen Code mit dem ich meine Datenbank in Count - 1 erg = 3D erg & db.TableDefs(x).Name & vbCrLf For y = 3D 0 To CurrentDb.TableDefs(x).Fields.Count - 1 erg = 3D erg & " - " & _ CurrentDb.TableDefs(x).Fields(y).Name & " " & _ CurrentDb.TableDefs(x).Fields(y).Type & " " & _ CurrentDb.TableDefs(x).Fields(y).Size & _ vbCrLf 'Dateinamen anzeigen Me.Text_Statuszeile = 3D CurrentDb.TableDefs(x