Closing Form causes a requery?

D

DawnTreader

Hello All

i have a main form that has a list box on it that uses a query to allow the
user to pick records to see on the main form. there are a bunch of combo
boxes and text boxes that the query uses as criteria to allow users to filter
the query. it was working fine, then i added a new filter box.

the filtering still works fine, but now when a user hits the exit button,
which causes a docmd.quit, it starts poping up parameter dialogs for each
text box that i use to put criteria in the query fields. it still exits, it
just pops up these boxes.

i took out the entire criteria and tried it and of course it fixes the
problem, but put the criteria back and it does it again.

i took the entire sql statement and put in in notepad temporarily, then
removed the criteria, saved, closed the application, right clicked and
compacted, then open the app and tried the exit, worked perfectly, no
dialogs. opened app, put the criteria back in compacted, opened the app
normally, exited and bang, dialogs for each criteria.

i have looked through my vba code on the form and there is nothing on the
exiting or closing of the form calling for a requery of the list box so i
dont understand why it is doing this. it has never done this before.

anyone have any idea as to why?
 
R

ryguy7272

Well, I guess you either have a Requery in your code, somewhere, or you
don’t. Hit Alt+F11. Ctrl+F and Find What = Requery. Click Current Project
and click Next. Is there any kind of ‘Requery’ in there that you didn’t know
about?

If that doesn’t do it for ya, try Compact and Repair. It’s a bit different
b/w 2007 version and earlier versions. Check out how to do it for your
version. This may help:
http://office.microsoft.com/en-us/access/HP051874491033.aspx
 
D

DawnTreader

hello Ryan

i have been all up and down this code. it is not something requerying. i
thought maybe the timing of some code would be the culprit so i moved it, but
that didnt fix it.

all i did was add one field to the filtering system and now the query that
is being filtered is requerying when the form unloads. i though i could put
in a new record source for the listbox and empty it before the form closes to
make this stop, but it didnt help.

this is a source of great frustration as it was 2 text boxes and some
additional sql in the query with a little VBA for initiating the filtering
mechanizm.
 
D

DawnTreader

Well what do you know...

docmd.quit causes it to requery

DoCmd.RunCommand acCmdExit does not.

dont know why, but problem solved.
 

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