Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

C++ Runtime Error trying to edit VBA code in Access 2003 1

Status
Not open for further replies.

CMPaccess

Technical User
Dec 18, 2003
52
AU
I have a database that was created in Access 2000.

I'm in the process of testing the database in 2003, however
if I try and edit any of the vba code in 2003 I get a
C++ runtime error and the prgram closes without saving.

I have tried to convert the db to 2003 and this makes no difference.

Has anyone got a clue what could be wrong.
The db works perfectly in 2000.

Thanks in advance
 
Have you checked the references ?
menu Tools -> References ...
did the db compile OK ?
menu Debug -> Compile ...

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
PHV,

thanks.

I have checked the references and they seem fine.

I tried using the complie option in the VBA editor as you suggest and it stops at the following line
at "column(3)"


Me![Title] = Me![DrawingID].Column(2) & " " & [DrawingID].Column(3) & " " & [DrawingID].Column(4)

The code for this seems to work fine but when the compile command stops at this point I get the same C++ error and access crashes.

Why does the routine work yet still cause ths error.

thanks in advance
 
Replace this:
& [DrawingID].Column(3) & " " & [DrawingID].Column(4)
By this:
& Me![DrawingID].Column(3) & " " & Me![DrawingID].Column(4)

BTW, have installed the Office2003 SP1 ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
PHV,

I will have to check on the SP. Not sure.

I will carry on through the compile feature and see if I can get rid of the errors.
do you think that will solve the problem ??

thanks
 
Else, I wouldn't be surprised if this was some kind of corruption issue - try the /decompile option on a copy, and see if it helps. Step by step approach here Decompile or how to reduce Microsoft Access MDB/MDE size and decrease start-up times

- but a C++ runtime error seems a bit strange - if the DB isn't corrupted, could it be something with the Access/Office installation? Would it occur on other databases?

Roy-Vidar
 
I have now compiled the code and got rid of the errors it found.

I still get the C++ error but I find it occurs when I try and access the editor from and open event on a form.

If i access it manually or through a command button I do not get a problem. Seems like could be a bug.

Will take a look at the decompile approach and SP 3 tomorrow. thanks again for your help

Cheers
 
Just recently I ran into this same error. The problem was with the default printer that I had selected. My default printer was have updates installed and this happened to cause a lot of Office issues that wouldn't seem like the default printer would matter. This caused me to get a C++ runtime error and have Access quit whenever I tried to edit VBA code.

Try choosing a new printer or removing the one you have selected to see if it helps.

Tom
 
Guys,

I still cannot get this problem resolved.

I have SP 1 installed for office 2003 !
I have compiled the code and got rid of all errors !

Tom, with regard to the printers could you be more specific in which ones you changed.

I have a default printer set as part of windows.

In access I have chosen to select a specific printer which is the sames as my default. IS that the problem ??

I have also done that on my reports.

Still a bit lost.

Cheers

Chris
 
You know I had the same problem a few years back with Access 97 and an update to DAO. Never did solve the problem though. My problem happened after during nightly updates of my reporting tables from our accounting system. If I ran all the steps in the macros at once Access would crash with that C++ error. So I worked around it by opening another instance of the database and closing the current one.

It seemed to happen to me when a certain amount of memory was used.

The only thing that I could find was that I had upgraded my Jet engine and it was not 100% compatible with the file created by an earlier Jet engine. Even though it was the same version of Access.
 
With my problem it simply had to do with the default printer I had chosen in windows. Start -> Settings -> Printers, and then I changed my default printer to a new one. This fixed the problem.

I have no idea as to why the printer matters when attempting to view the code behind a form, but it seems to. I don't think the printer you have chosen for your reports should matter.

Your issue may not be the same one I had, but I recieved an identical error whenever I attempted to view code behind a form. I did not recieve this error when hitting Ctrl-G to bring up the vba editor, nor when I opened the code through the Project window in the editor. It only occurred when I had a form open in design view and I either clicked the code button on the toolbar or attempted to add/view code through a control's event in the properties popup.

I would try each of the following, checking to see if it works after each one:
- Change the default printer in the Printers control panel
- Delete the printer from the control panel
- Add the printer back and reset it as your default
- Possibly try changing the default printer and the selected printer for Access and all of the reports (Although this would probably be painstakingly difficult and I would only try it as a last resort)

Good luck,
Tom
 
Tom.

You were spot on. Your problem is exactly what I was getting.

I found that by having my default printer set to the microsoft image writer the problem just does not occur.

Seems like that has to be a bug to me but at least it lets us edit the VBA trouble free.

Thanks all for your help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top