Linking Tables

  • Thread starter Thread starter Simon Davis
  • Start date Start date
S

Simon Davis

Access 2K

Is there a way to check links to tables in another access
database and if links not found, automatically launch
linked table manager

Thanks in advance

Simon
 
Thanks for the info, I checked out the info and pasted it
into a module but nothing happened. I should have stated
that I am a novice to modules, do modules run
automatically or do I need to call them ( I have set up
an "Autoexec" macro and called the module "RefreshLinks")
Any help gratefully recieved.

Simon


Is there an idiot guide to modules that I should refer to
 
Hi Simon,

As instructed in the website (as you have done), paste the code. The
fRefreshLinks web page should give you 6 functions.
You should also cut and paste the GetOpenFilename web page which would give
you 5 functions.

I'm not too familiar with macros but once you've done the above, I think you
can insert a line with RunCode Action and fRefreshLinks() as the function in
your Autoexec macro.

To answer your question, codes in modules do not run automatically. They
just sit there waiting to be called by some event from various places (i.e.
forms, reports, other modules).

Please post back, if you still have a problem.


HTH,
Immanuel Sibero
 
Hi Immanual,
I must be really stupid or worse.
I have pasted the GetOpenFilename code into a new module
and set up the macro as you suggested-nothing happened

I cancelled that and then created an event procedure for
the "OnLoad" action of my startup form-still nothing
happened.

I then looked through the code to see if there was
anything obvious-My brain hurts.

Any suggestions ?
Thanks for your patience

Simon
 
Hi Simon

To see if you've got everything set up correctly, try this

- With the database window on your screen, press Ctrl-Z. This will bring up
VB Editor.
- Go into the Immediate Pane, type in call fRefreshLinks(). This will call
and execute the fRefreshLinks.

If the above works, then we know you've got the modules set up correctly. We
can then proceed to see how you're calling it from a macro or a form.

HTH,
Immanuel Sibero
 
Access2K
XP pro

Hi Immanuel,
Did as you suggested and got the following error message :

Compiler Error User-Defind Type Not Defined
for-

Dim dbCurr As Database, dbLink As Database
Dim tdfLocal As TableD

I revisited the code and did a fresh copy and paste -
still got the above.
Should I be entering the tables database name somewhere in
the code ?

Again, thanks for your patience

Simon
 
Compiler Error User-Defind Type Not Defined
for-
Dim dbCurr As Database, dbLink As Database
Dim tdfLocal As TableD

In Access 2000 and 2002, only the ADO Reference is set by default, so a
Recordset would be assumed to be an ADO Recordset. Obviously you mean to use
DAO, in which there is a Database object (there's no Database object in ADO,
and that's why Access is assuming it's "user defined" -- there's no such
object in any of the default References nor built in to Access itself).

Open any module, and on the module window menu, Tools, References, scroll
down to Microsoft Data Access Objects 3.6, check the box. Then, if you are
mostly using DAO code (as you are in your post), move that reference up
higher than the ADO reference just in case. Then, go into your code and
qualify all the DAO objects with DAO.<object> in the Dims... e.g.

Dim rs as DAO.Recordset

You could get by without qualifying "Database" as there is no corresponding
ADO "Database" object to confuse, but I'd recommend using the "DAO." prefix
even there, just for clarity.

(If you've just moved to the newer version from Access 97 or earlier, you
are used to having the DAO reference checked by default, and no ADO
reference. Thus, you didn't have to qualify the Dim's, because the only
Library referenced with any objects by those names is DAO.)

Larry Linson
Microsoft Access MVP
 
UREKA ! - Thanks for your patience - All working well.

Many thanks to Larry and Immanuel for your help

Simon
 
Back
Top