.requery wont work.

R

RoddyVR

we've just updated to office 2003 (from 97) at my work, and one subfor
in one form has stopped working. the rest work fine.
here's its situation:

its a datasheet subform that shows the detail for orders.
when a button above it is clicked it creates the order record, and i
also creates some of the order detail (defaults set on some paramater
in the form).
then the subform (which draws its data from a query which is filtere
on the value of a textbox that the button above populates with th
ordernumber) is supposed to be requeried with the new data, and then i
gets the focus so the user can alter the order if needed.

the creating the data button works. it makes the data as it alway
has.
the records all get created (i checked in the tables).
the set focus thing works. the subform gets the focus.

but it never gets the data its suposed to be displaying.
i can add more records in it and that works fine, so its not completel
lost its connection to the data, but for some reason it doesnt refresh.

there is another button on the main form that has this code:

Code
-------------------
Private Sub cmdRefreshDetails_Click()
Me.BookOrder_Details_subform.Requery
Me.BookOrder_Details_subform.SetFocus
End Su
-------------------

which i used to use to refresh the subform in order to edit old orders
but this doesnt work anymore either.
i cant figure out how to make the code any less error prone. and i
never actualy gives me an error. it jsut doesnt do the .requery
or more specificaly it does it (i steped through the code) but i
doesnt work the way its supposed to.
i tried the .refresh thing instead, and that doesnt work either.
i'm not sure of the difference between .refresh and .requery, but sinc
neither works i dont thing their difference matters. i'm not married t
either so if someone sugests a way to get one of them to work i'll us
that one.

in case this matters:
the form is in a "front end" database and the data is actualy o
another computer in a seperate database (also access) that just has th
data tables.
so far everything else (including other subforms on the same form) see
to work fine, since the upgrade to 2003.
i've set the macro security setting to "low" because it kept asking m
if i trusted my own database not to include "mallicios code" o
something.
we've got the enterprise eddition of office 2003 pro. and it
complete/full installs. so i dont think i should be missing an
components of office
 
B

Bob Howard

I had a similar problem with testing my application under A2003 in that the
query was referring to a control on a subform and was not coming up with the
right info. I created an unbound control on the main form and changed the
query to refer to that control inrtead. This also meant that I had to make
sure to duplicate the information from the subform to the control on the
main form when I recognized that it changed. It was a real pain and
difficult to find. I checked the MS knowledge base for A2003, but was never
able to find a reported bug (hence a fix) for this.
 
P

Peanut1

hi,
i just came across the same problem, i think it is a bug with 2003, the
requery does not work from event triggers where it used to in prev versions.
I found the only way i could make it work is:
Put the requery statement by itself in a Public Module, ie,

Forms!mainform!subform.requery
then call the module from any form's after update or on close event.



Bob Howard said:
I had a similar problem with testing my application under A2003 in that the
query was referring to a control on a subform and was not coming up with the
right info. I created an unbound control on the main form and changed the
query to refer to that control inrtead. This also meant that I had to make
sure to duplicate the information from the subform to the control on the
main form when I recognized that it changed. It was a real pain and
difficult to find. I checked the MS knowledge base for A2003, but was never
able to find a reported bug (hence a fix) for this.
 
R

RoddyVR

i tried that. in addition to being a very cumbersome way of requeryin
a form, it still doesnt work for me.
the stupid thing is that there are a bunch of other subforms on th
same main form that work the same way and seem to have no problem
refreshing at all.

i'm trying to isolate the problem. got this far.
deleted the subform off the main form, so that i could run i
seperately.
ran the main form. put an existing order number into the textbox tha
holds it.
then ran the subform seperately.
still empty.
however, if i go to its datasource (sql statement. non saved query
then it shows the order details fine.
go back to the subform and its still empty.
it only shows them if i try to apply a filter to the form and then tak
it off. then it shows the records that its underlying sql statemen
generates.

i get the feeling that access somehow added an invisible filter to m
(sub)form somehow.
trying to find a way to simulate the "remove filter" button from v
code to just run when the form loads. but havent found it yet
 
R

RoddyVR

ran another interesting test.

saved the query that hte (now split off) form is based on.
added a field to the query : [ask me]
which prompts me to enter something whenever the query is run.
if i run the query it asks. and then puts my response into the extr
field in the query (my input doesnt affect anything)

then i run the form that is based on this query, and it never asks.
which leads me to assume that the form never actualy runs the quer
that it is based on.
how is that even possible?
how can any form run without running its datasource?
i'm completely lost now
 
R

RoddyVR

ok. i am now standing in the corner and wearing a cone shaped hat wit
the word "dunce" on it.
figured out why the stupid subform wasnt working.
it had the "data entry" property set to yes. so ofcourse it didnt giv
a dam what the data in it should be but only cared what i was gonna pu
in there.
i cannot believe i didnt notice that sooner.
and how did it set itself to that? i doubt i was stupid enough t
actualy set it, but i cant belive that acecss would just randoml
assign that value to a form
 

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