By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,870 Members | 2,347 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,870 IT Pros & Developers. It's quick & easy.

Errors only arise in the compiled exe file when accessing Access database

P: 2
I have a program that interrogates and modifies an Access database. When I run this program from the VB editor it runs fine. When I make the exe file and run that it crashes saying that the "Object invalid or no longer set". Whilst the exe file is in a diferent folder to that of the source, I have made sure I give the full path names to all files I access. Has anyone else had this problem and got any ideas how to fix it. The crash always occurs at a point when it is trying to acces the database (or so it seems).

I have been trying to fix this for months now but cannot see what he problem is. Like I say it works perfectly until I make the exe file and run that. The section of code which I think is responsible is as follows:
Expand|Select|Wrap|Line Numbers
  1. Sub CashUp_Click()
  2. isoutofstock = False
  3. For n = 1 To MSFlexGrid2.Rows - 1
  4.     If ProdDetails(n).ProdStock = 0 Then isoutofstock = True
  5. Next
  6. If isoutofstock Then Call POrderRaise
  7. If POraised And MSFlexGrid2.Rows = 1 Then Cancel_Click: Exit Sub
  8. nextReceiptNumber = GetNextNo(1)
  9. Set pdb = OpenDatabase(dbName)
  10. Set p_rec = pdb.OpenRecordset("TillReceipts")
  11. ...
  12.  
I am running VB6 on Windows XP Professional. The database is an Access 2000 database.
Apr 20 '07 #1
Share this Question
Share on Google+
3 Replies


Expert 5K+
P: 8,434
That is a bit of an odd one.

Are you sure you're specifying full paths and not partial ones? If you're using a partial (or "relative") path, then it will be dependent on the current path, which could change during execution.
Apr 21 '07 #2

P: 2
That is a bit of an odd one.

Are you sure you're specifying full paths and not partial ones? If you're using a partial (or "relative") path, then it will be dependent on the current path, which could change during execution.
Hi Killer42

Thanks for your comment. It is an odd one. However, no I have not fallen for that one. I store a full path name with drive ina global variable. I have even ensured that the exe file is in the same folder as the source files so they are both (the compiled and uncompiled forms) run from the same location.

Any other ideas?
Steve
Apr 25 '07 #3

Expert 5K+
P: 8,434
Thanks for your comment. It is an odd one. However, no I have not fallen for that one. I store a full path name with drive ina global variable. I have even ensured that the exe file is in the same folder as the source files so they are both (the compiled and uncompiled forms) run from the same location.
Um...

Not really. It sounds like something related to an ActiveX control, but beyond that I'm stumped.

You might put in some logging and/or error handling to track down exactly where it's happening. Also, as a debugging thing, I guess you could try switching around your compile options such as P-Code/native, optimisations, upgrade ActiveX, remove info about unused ActiveX, and so on.
Apr 25 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.