Link to home
Start Free TrialLog in
Avatar of myotis
myotis

asked on

Code Works on Mine but Not Others??

I have a database that I have written in Access '97.  There is some simple code in it like to capitolize the first letter of a persons name, is the number they enter between these two number, etc.  Nothing fancy.  In developing the database it worked on my home computer and my work computer.  But, now the code works fine at home but on any other computer it won't work.  I have installed the SR-2 pack but the code problems were there before the installation.  I have tried repairing the database, compacting the database, everything!  I've even tried deleting the code and retyping it in another database that I created on that computer and it works!  What would cause the code not work on a database saved on my computer then ran on another?  I don't know what to do! Is there a problem between versions? Where do I begin and has anyone else had this happen to them?
Avatar of myotis
myotis

ASKER

Edited text of question
Hi, myotis!
Try this: in Menu->Tools->References uncheck all references, close your database, open it again and reestablish references.

Let me know the result.
Dedushka
also, try ... well, there's a DLL file I forget which *G* *sorry*  I think it's something like OFF97.dll

I had some problems where the SP-1 upgrade where the DLL file was not updated, could be the same problem with SP2
Do you use a network at work?
Dedushka has the right approach. The problem is related to differences in the version of some of the referenced files. This can come from different version of Access on the two computers, but also from having installed other programs that uses the same ActiveX controls etc. If you want the code to work on both computers you will have to make sure that they have the same set of files. Check out ComDlg32.ocx, ComCtl32.ocx, MSO97.dll, Dao350.dll, MSAcc8.OLB and Vba332.dll (these are some of the most common files to have referenced)
Or instead of that you can edit the failing functions to have the prefix "VBA.".  Many times the VBA library doesn't link correctly, but if you tell the application which library to look at, it works fine.  It's also a good idea to do this because if your application is ever installed on another machine, it will work from the start instead of needing to be checked out.

Zen
Avatar of myotis

ASKER

ZenMaster

Not to sound to lost but where do I put the prefix "VBA" ?  I do need the database to work on different machines.  The code fails no matter if it is in a form or report and I have several of each.

Dedushka,

I looked in the "Tools" menu for "References" I didn't see anything that said "References", I also tried under the "Options" in the Tools menu.  Could you be little more specific for a newbie?

billinb,

No, I am not on a network system.
Hi, myotis!

"References" appears in Tools when you switch to module design view. Open some module in design view and you see "References in menu.

Good luck,
Dedushka
In front of date conversions, string conversions, "C"-functions (CDate, CInt), etc.  (Type somewhere in your code "VBA." (no quotes) and the affected functions will list out...).  It's smarter to do this in your code because if the copy of Access that will run this (the workstation's copy) does not have the reference, it will have to be re-configured.

If you don't mind doing the re-configuring, open Access (your app), click Modules on the database window, then select Tools|References.  Scroll down the list to find "Visual Basic for Applications".  There may be several, choose the one that when highlighted says vbeext1.olb in the path box at the bottom.  Check it and say OK.  This will need to be done to EACH machine the application is on.

Zen
Duh:  The module will have to be in design mode to get the proper references screen... (like Dedushka said)

Zen
Avatar of myotis

ASKER

Dedushka & ZenMaster,

It worked!! After I went to the the design view of a new module it worked!!  My machine at work was missing a Fractual OCX file.  After I unchecked all of the files I could or Access would let me, I closed the database then reopen it and it seems to work!!  I didn't go back and recheck any of the references I has previously unchecked do I need to??  The program is only to run on about three machines so this should be an okay method for me!!

ZenMaster,
I didn't have any "C" - functions the code was in the event procedures of the text boxes, afterupdate - onclick etc.  An example of the code is:
'   Capitalize first letter
    If Not (IsNull(Me!FirstName)) Then
    Me!FirstName = CapitalizeFirst((Me!FirstName))
    End If
   
End Sub

Also, I didn't have a Visual Basci for Applications when highlighted had a path of vbeext1.olb.

Trygve,
I looked for the *.dll you had mentioned on the computer at work (not the one that the app would work on) my machine didn't have any of them.  I didn't look for a *.ocx
Congratulations, myotis!

Can i post my first comment as answer?

Dedushka
Avatar of myotis

ASKER

Sure go ahead and post it. ZenMaster was also a big help and I really want to thank him/her.  ZenMaster's would be the ideal approach if I was to distribute it on alot of machines but with the small number that will run this app yours was the easiest method, THank You for your assisstance.  Was this something that happens alot with added *.ocx's?  It was the first time I've heard of it and none of the classes I've taken on Access even bother to talk about this issue.
ASKER CERTIFIED SOLUTION
Avatar of Dedushka
Dedushka

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
I get the next one, Dedushka!