Database has a problem

HandSam

Registered User.
Local time
Today, 03:22
Joined
May 18, 2012
Messages
48
I am new here and I would appreciate being corrected if I am posting in the wrong place. I have a system that is working fine but no longer reports errors. eg, if I add a new button, and the VBA code has an if........ but I forgot to add the "end if", instead of the system showing the error "Block if without end if", it doesn't do anything. I am thus impaired whenever I try to expand the database because whenever there is an error, it will never report. I will really appreciate any help:confused:
 
Have you anywhere placed On Error Resume Next statement?
 
Yes, I have placed the On Error Resume Next statement in some parts of the code. The problem is that even if I create a new form with 1 button and place code behind it, the system will not report any errors. It used to report the errors when it was smaller and had few forms. It does not report errors even when I use it in other machines. However, there is a time it reported once in another machine and then it stopped.
 
somewhere in your code or macro, you have probably done SetWarnings False, the code failed before turning the wanings on again, and here you are. If you do SetWarningsFalse, then you have make sure to do SetWarnings True, no matter what. That should happen when you exit the sub, also after passing through some error handler, if the normal code fails.
 
Have you changed anything in the Options.

Found in the Main Menu.

If not rem out all occurances of On Error Resume Next.

Use the Find and Replace Facility.

Do the same for Set Warnings but first run some code to turn it on.
 
I am really grateful for the much you are doing to help me out. Thanx to you all.
Pr2-eugin, I commented all my 'On Error Resume Next' statements in the whole database, but my problem still remains. @spikepl, I have not set Warnings to false, they are ON. @RainLover, I do not remember changing anything of that nature in the options.
Here is a button I just added, watch how it behaves:

Private Sub Test_Click()
MsgBox "Hi There"

If 2 = 2 Then
MsgBox "Two equals two"


MsgBox "Good Bye"

End Sub

'since there is no 'end if' in the code, the button does nothing when clicked. A few days ago, I opened the database in design view, and run 'Compact and Repair database' and it worked on that day. It was in a different (powerful) machine. I have tried that dozens of times in my comp but it still bears no fruits
 
Does it not display any of the Messages? Try compiling the DB.. and see what happens..
 
Just a guess but do you have the following at the top of the Code.

Option Compare Database
Option Explicit
 
If it works on another machine then perhaps it is your Access that is messed up.

If you make a new db does it do the warning stuff properly? If it does, import all your objects into that. Done.
 
Pr2-eugin, I have compiled the above code but nothing happens. Rain, my code has the two statements at the top. Spikepl, my code worked on that machine once, it doesn't work even in any other machine now. FYI, I wrote another database using my machine and everything in that database works just fine including error reporting. So I feel there is something really funny about my database.
 
If it does, import all your objects into that. Done.

If that fails, then your code is messing up the settings.
 
Try a reinstall of Access.

Compact and Repair.

Also a Decompile.

Make a back up NOW.
 
Hmmm.. Not sure..
* You have checked the options,
* Compiled the DB,
* Removed Resume Next,
* Checked for Warnings..
* Included Option Explicit..

Running out of Options; really.. I think you could try Decompiling the DB after making a backup.. maybe it helps.. To decompile.. create a shortcut wiith the following..
Code:
"C:\Program Files\Microsoft Office\Office\MSACCESS.EXE" "d:\My Documents\access\mayapp.mdb"  /decompile
Make sure the locations are correct.. I mean the location of MSACCESS.exe and your file..
 
Errr.. if another JUST CREATED db works on OP's machine then no point in reinstalling access, is there? :D
 
I followed your advice Spikepl and imported the database into another and wooosh! The database works like charm. I am really puzzled that you people work everything out to ensure you help someone out. I am really grateful, it had been a problem for quite a long time, it was a desperate reach, but turned out to be the savior. Thanks to all of you. Thank you again
 
This database has been everything to me. Whenever it is not working, it makes me depressed. It however seems that I have no reasons of feeling depressed anymore. After following your advice, the database now works perfectly. Spikepl I imported the whole database into a new one and everything now works perfectly. pr2 and Rain, I am also really grateful, I event did not know about decompiling a database, now I do, courtesy of you. Its puzzling to know that you guys do all you can to help one solve their problems, I am really grateful. Thank you all again.
 
HandSam

Only half of your problem is solved.

What you need to do now is to work out why it failed in the first place.

The best advise I can give you right now is to do regular Back Ups.
 

Users who are viewing this thread

Back
Top Bottom