Solved

Code Works on Mine but Not Others??

Posted on 1999-01-24
15
201 Views
Last Modified: 2011-10-03
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?
0
Comment
Question by:myotis
  • 4
  • 4
  • 4
  • +3
15 Comments
 

Author Comment

by:myotis
ID: 1977649
Edited text of question
0
 
LVL 7

Expert Comment

by:Dedushka
ID: 1977650
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
0
 
LVL 3

Expert Comment

by:chapie
ID: 1977651
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
0
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 
LVL 1

Expert Comment

by:billinb
ID: 1977652
Do you use a network at work?
0
 
LVL 12

Expert Comment

by:Trygve
ID: 1977653
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)
0
 
LVL 1

Expert Comment

by:ZenMaster
ID: 1977654
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
0
 

Author Comment

by:myotis
ID: 1977655
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.
0
 
LVL 7

Expert Comment

by:Dedushka
ID: 1977656
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
0
 
LVL 1

Expert Comment

by:ZenMaster
ID: 1977657
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
0
 
LVL 1

Expert Comment

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

Zen
0
 

Author Comment

by:myotis
ID: 1977659
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
0
 
LVL 7

Expert Comment

by:Dedushka
ID: 1977660
Congratulations, myotis!

Can i post my first comment as answer?

Dedushka
0
 

Author Comment

by:myotis
ID: 1977661
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.
0
 
LVL 7

Accepted Solution

by:
Dedushka earned 70 total points
ID: 1977662
Hi, myotis!
Try this: in Menu->Tools->References uncheck all references, close your database, open it again and reestablish references.

Thank you for accepting my answer.

Sorry, myotis, i can't say something about your last question, because i use only MS Access standard controls.

Best regards,
Dedushka
0
 
LVL 1

Expert Comment

by:ZenMaster
ID: 1977663
I get the next one, Dedushka!
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question