Link to home
Start Free TrialLog in
Avatar of sikan71
sikan71

asked on

Fixing Reference Direct.ocx version

After copying the database on to a different machine I keep getting the following error when ever I open the database:
"The database project contains a missing or broken reference to file 'Direct.ocx' version 1.0
To ensure...."

Every time I start the database have to go to Tools ==> References and unceck the line with missing or broken reference.

Is there a better way. I am also expecting more errors of this kind when I install the database in other machines.

Please Help!!!
SOLUTION
Avatar of seipel-rotter
seipel-rotter
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Avatar of rockiroads
rockiroads
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sikan71
sikan71

ASKER


- Wich access version do you use
  version 2002
- which differences are between the two machines? (access-version, windows-version etc.)
   differenece is in the operating system. my machine has windows 98 and the other system has windows xp

the other answers will be posted as soon as i get to the machines
If you don't need the refernce uncheck it on your version
Avatar of sikan71

ASKER

where does this code reside (i.e., module or anything else) and how does it get invoked ( i am a newbie to programming please bear with me)
Example on how I got the problem

I used the following controls - MSFlexGrid, RichTextBox, CommonControls, ComCtl

I developed on Windows 2000 (windows install dir is C:\WINNT)

users have Windows XP (windows install is C:\WINDOWS)

Now because my controls were in WinNT\System32, that directory does not exist in the users PC, although they have the file in C:\Windows\System32

So you need to refresh references

The manual way is to go to modules, open up a module, tools, references, check a new reference, exit. Then go back in to references, uncheck then exit.

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Ok, just add the code into a modue

then call it, can call it via a form at a click of a button
Avatar of sikan71

ASKER

tbsgadi..how does one ensure that it is the first piece of code that is run in the application i.e. where should this reference reside???
Avatar of sikan71

ASKER

rockiroads:
I put the code in module and compiled:

I got the variable not defined at "APP_TITLE"  


sorry, app_title was a constant I had defined, just change it to any text you want i.e.   "Database Copy"

have you figured out from where to call it?

Do you have a logon form, or menu, if so, you can use the Form_Load function so references are refreshed everytime you start.
Otherwise, like I did, have a seperate form, a button exists on the form (lets call it cmdRefreshRef) and so the handler for its click button calls the module
i.e

private sub cmdRefreshref_Click
    Install_RefreshReferences TRUE
end sub

by the way, TRUE is optional - just play about with it and see
Avatar of sikan71

ASKER

I keep the apps_title to the name of the database with in my case is TelDatabase. So here is the addition I am going to make:
dim App_Title as string

App_title = "TelDatabase"

I am going to call it from the on_load event of the switch board that is opens up when opening the database. In the on_load event I will add the following:

Install_RefreshReferences True

Please let me know if I am going in the right direction.

Thanks!
looks ok,

define the const

private (or public) Const APP_TITLE = "..."

The procedure is called Form_Load  (your on_load event)

private sub Form_Load()
    Install_RefreshReferences
end sub

like I said, TRUE refreshes everything, FALSE refreshes those busted, once done play with it to see if you get your required results
Avatar of sikan71

ASKER

rockiroads..it works did not work on one of the target computers. I got the MSADOX.dll error. On clicking "OK" I got another window with the following error:

Reference Insert Faliure (57015): Cant add a reference to the specific file.

Any comments...
Is MSADOX.dll installed? It should be in the System32 directory (or otherwise where reference is directly called)
On your working PC, go to module, open up any module, and click on Tools/References

look at the checked items and see which one is MSADOX.dll, it should give you the path and name of reference

Then check on on the failing PC
It could be failing to insert since it does not exist

code removes existing references, then installs those references, if any are missing then there will be a problem.

Avatar of sikan71

ASKER

Thanks...I did not understand the "Installs" references part. Pardon me I am a newbie and am trying to understand what the code does...

Another related/unrelated question: does it make any difference if the references are repointed to to a new area on the computer manually.
When access uses controls, a lot of these controls are accesed in external files (dll, ocx etc)
You when you create a application which uses controls, most would be standard windows installs, but some are not part and so have to be installed seperately.

In Tools/References, the checked items gives you a list of what you are using and the path.

Problem with the path is people also have controls installed in different directories i.e. C:\Windows or C:\WinNT
So you have to fix this reference (either manually or thru some code)
Windows should pick up on this, if the control exists in your system32 directory (I think it actually uses some path environment variable but unsure).
If it does not exist (and not in any directories in your path?) then you would typically get the error you are seeing.


    Access.References - gives you info on what references you are using

   Access.References(intX) - get info about one reference

  The .IsBroken property tells you whether the control is missing or not

  The .Remove property tells Access to remove  the specified reference (before we do this, we keep a copy of the reference name)

  .AddFromFile property will create the reference using the file specified
 
 
Avatar of sikan71

ASKER

This hopefully should end this discussion unless something else crops:
In case the code does not work, then is it safe to assume that we may manually provide reference to the particular files. Will this process do anything to jepordize the Access application??

so as long as the files you use (including dll's) exist on the windows installation that will use the app, you should be ok

What I have done is created a install script which always installs in C:\<appdir>
within there I created a directory called ctls which contains all the files not normally available on standard window installs
I developed using that path and so when I ship the database out with the controls, I just get them to run my refresh references code and so all is okay