Requery multiple fields when one changes

G

Guest

I'm trying to requery multiple fields when a specific field changes. My
macro says:

Echo
Requery (it refers to a specific field)
Requery (same as above)
Requery (same as above)
CancelEvent

I have it set to trigger on the AfterUpdate event. I've tried it on the
AfterChange. It works wonderfully on the current record. But as soon as I
go to a new record, it happily changes all existing records. How do I tell
it to only requery the current record?
 
S

Steve Schapel

JD,

Could you please give us some more details of what you are fdoing?
Maybe some specific examples will help? I do not understand the concept
of requery a field, nor do I understnad which event you are trying to
cancel with the CancelEvent, nor can I imagine what you mean by "it
happily changes all existing records".
 
G

Guest

I have 5 combo boxes that all rely on the answer selected in the previous
combo. The first combo is called SchManager, the second is Function.

I have a query attached to the Function combo that goes like this: SELECT
FunctionTbl.FunctionID, FunctionTbl.Function, FunctionTbl.Manager FROM
FunctionTbl WHERE
(((FunctionTbl.Manager)=Forms!ScheduleTbl_QryForm!SchManager)) ORDER BY
FunctionTbl.Function;

Subsequent combos have the same query - just changed to suit the situation.
And it all works. I set a Requery on each record (now sitting on the OnEnter
Event) so that as a selection is made it narrows the selection. If I don't
requery, it displays incorrect options.

So while I'm on the current record it all works fine. As I move to
subsequent records - it still works as it should. But the display of
previous records goes away. However, the correct info is in the underlying
table. It seems to be a display issue on a continuous form. I tried
datasheet view, and it does the same thing. I think if it was a single
record/single form thing - it wouldn't be a problem. But I don't want that.
 
S

Steve Schapel

JD,

Ok, thanks for the further explanation.

If you Requery the comboboxes, then their lists will be restricted to
the criteria based on the current record. You should not Requery. On
the Enter event of each combobox, use a macro with a SetValue action to
set the value of the combobox's RowSource property to a query such as
you gave in your example. And then in the combobox's Exit property, use
another SetValue action to set the RowSource back to a query without
criteria, in your example something like...
SELECT FunctionTbl.FunctionID, FunctionTbl.Function, FunctionTbl.Manager
FROM FunctionTbl;
 

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

Similar Threads


Top