search query on form causes db to crash

A

Alan B.

Hello,

I have a search utility that I've created. It's activated by a command
button on my form. It allows me to search for specific data in my DB and
then populates the form with that records data. The form is a bound form.

This utility works well in dozens of databases that I have, but all of a
sudden I'm having a problem on one form. When I do the first search it works
perfectly. When I do a second search (without closing the form first) it
crashes the program, and the program closes. If I restart the program, the
same scenario.

Sometimes, if I do a search, then manually use the form's navigation buttons
to go to a different record, and then run a new search, it doesn't crash.

Does anyone have any ideas how to fix this? Compacting and repairing the
database has no effect on it, nor does decompiling, then compacting and
compiling.

Regards,
Alan
 
G

Gordon Lincoln

Hi Alan,

If we assume (very dangerous) that you don't have a coding issue here - then
it has to be corruption, right?

I have had a monster problem where nothing seemed to work - spent a couple
days on it then created a new database, imported the tables and forms one by
one, seeing how various things were working step by step until I hit one
particular form that crashed things.

Painful solution but what worked was doing the imports all over again to
another new database, excepting that one form, then re-creating the
troublesome form from scratch.

That being said - odds are pretty good that some property or bit of code is
whacking you and if you can isolate it - then you won't have to go to the
above extreme.

I might try making a copy of the form, then dumping everything from the copy
except what I had to have to make the search function work and see if it
still breaks. If no, then start restoring bit by bit until it does break, if
it does break, then I'd probably start rebuilding the problem form from
scratch assuming some deep, dark bit has gotten twisted and whenever my code
hits that errant bit - it tries to execute something stupid like jumping to
address 0, or the like.

Hope this helps,
Gordon
 
M

Marshall Barton

It may or may not be relevant to your situation, but IME the
most common cause of code module corruption is editing a
form or report's code module while the form/report is open
in any view other than design view. I hardly ever see this
since I made it a habit to switch back to design view before
typing anything in a cade module.
 
K

Klaus-Dieter Gundermann

It may or may not be relevant to your situation, but IME the
most common cause of code module corruption is editing a
form or report's code module while the form/report is open
in any view other than design view. I hardly ever see this
since I made it a habit to switch back to design view before
typing anything in a cade module.
Hi Marsh,

Yes I am aware of this. And it seems that you have to close ALL forms
before changing the code of one form.
But how can I remove such code module corruption, as a decompile does not help?

Greetings

Klaus
 
P

Paul Shapiro

If you know which form is corrupted, you can save the VBA module for that
form and then set the form's HasModule property to false. That removes the
module and code. Then add the code back to the form after a compact &
repair.

If you don't know which object is corrupted, you could try creating a new
blank db and import everything from the old db. I usually import all the
tables first, together, so relationships will be copied with the tables.
Then I would try all the queries, and again compact & repair. Continue until
either it's all ok, or you identify the source of the problem.
 
M

Marshall Barton

Klaus-Dieter Gundermann said:
It may or may not be relevant to your situation, but IME the
most common cause of code module corruption is editing a
form or report's code module while the form/report is open
in any view other than design view. I hardly ever see this
since I made it a habit to switch back to design view before
typing anything in a cade module.

Yes I am aware of this. And it seems that you have to close ALL forms
before changing the code of one form.
But how can I remove such code module corruption, as a decompile does not help?[/QUOTE]


If Decompile or Setting HasModule to No does not clear the
problem, then it is rather unlikely that there was module
corruption.

I have not had to close all other forms before editing one
form's code module.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top