Unhandled exception in VB6.EXE: 0xC00000005: Access Violation

my software recently crashes everytime it access it's DB and this error shows up when i click on the "debug" button. I am able to fix this sometimes when I set the Database name and RecordSource to the same DB and table. But every morning, the problem comes back. Please advice. thanks

Attached is a prtscr of my references. Read something saying that my references can possibly screw my prog up.

Access *.mdb? Try compact/repair on exit...

Good Luck

The DB isn't the problem because i tried accessing the same DB on a different program and it works fine. The thing is, I didn't change anything the last time it worked. Ill upload the whole app so you could check it for yourself. Thanks!

hmmm... In references, move dao up so it is before anything to do with data access or ADO... Also, the use of option explcit will solve some other problems you may be having and in frmMain, you should at least be using the query unload event to test why the form is closing as when I ran your project and click on the x in upper right, prog was still running. You could use the query unload event to test why the form is closing and show the login form again or unload all forms as necessary...

Good Luck

1. Moving the DAO in References didn't solve the Unhandled Exception Error.

2. What do you mean by Option Explicit?

3. Moving through forms doesn't create the error message. Its when i actually use the datacontrol.

Were you able to view the records? Because i didn't

Okay, you have the Data control database name set in the properties window to "C:\My Documents\Actron\Customer Complain\CustomerServiceDB97.mdb" which of course errors on my machine as I don't have that path. You do realize that you can set the path in code if you wanted (db1.databasename = "C:\..." or App.Path & "\...mdb"), of which I did this in your frmview load event...

Private Sub Form_Load()

db1.DatabaseName = App.Path & "\CustomerServiceDB97.mdb"
End Sub

and because of this I was able to view the records...

As for option explict AKA Tools>Options>Editor tab>Require Variable Declaration... This forces you to declare every variable used and if you make a typo, it'll tell you when you go to run the program that the variable has not been declared...


Good Luck

I added this code on to the frmMain_load() and now after i log in it crashes.=(

db.databasename = app.path &...

Since that one form has the only data control that you use, you would need to reference that form and use the right control name "db1"...

Good Luck

i know. it's stil frmview.db1...... i had no choice but to start all over again. since this has stalled me for 2weeks now

frmLog.Visible = False
frmMain.Visible = True

even this make's my vb crash! WTF

created a new project and same thing happens except now it crashes on

form.visible=false

tried reinstalling vb6 but nothing changed. please help. I'm now officially desperate. I'm gonna get fired for this if I don't fix this

Lets see your new code/project...

Good Luck

My second trial has crashed too. but on a different part of the code. T_T I tried reinstalling my vb but still didn't work. A colleague of mine said to try using vb8. Is it worth trying? or there's a solution for this? this problem would probably get me fired. T_T

This is the 2nd project. thanks!

Yeah that is strange, Disk or Network Error and still the form loads....


Okay, got a couple of things for you to do...

First, start a new standard exe project and goto Tools>Options>Editor Tab and make sure there is a check next to Require Variable Declaration>OK

Second, close that out and start a new standard exe project. Add a form (Form2) and in form load of form1 or under a command button, put the same code... meaning load form2/form2.show.

Now, does that error appear again?
1. Yes? Vista or 7? Then right click on vb6.exe and select runas admin.
No? Well then, we have concluded that it is not the form so add the dataenvironment/report. Did that error appear again?
Yes GoTo 1 right above...

The only other thought I have about that error is that the hard disk might have a bad sector so copy the whole project to a new folder (I doubt this but it is a problem that can happen).

Beyond that, I can only guess it is something that you have done when you added something or saved something...?????

Good Luck

First, "Require variable declaration" has been enabled even before i started this project.

Second, No, Form2 loaded just fine.

Third, I have XP, did what you told me and still no errors.

Fourth, about the bad sector, I made the 2nd project on a different partition so the hard disk does not have anything to do with this.

And like i said, I didn't add anything to it the last time it ran properly. it just crash the next morning.

Don't know what to say??? But I am wondering why your vbp file is pointing to program files for some of your references instead of system32 but then again that may be normal as I don't look at the contents of them every day... Best bet is to start all over and just copy the code from old to new...

Good Luck

HOMAIGOD! :( anyway, I appreciate you trying to fix this. gah *copy paste again*

OMG! i copied and pasted everything and it worked again. WTH is wrong with this. T_T

db.Recordset.FindLast CCIF_No = ""

now codes like this gets a "variable not defined" error on the "CCIF_No=" part

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.