Requery

  • Thread starter Thread starter Mia
  • Start date Start date
M

Mia

I added a subform to my main form. I want to requery that
subform anytime my combo box information is changed. For
my combo box "OnClick" function, I have it running a Macro
that would first run my query, then requery my subform.
Every time I run it, though, it gives me an error "There
is no field called 'Intensity Work Request' in the current
record.". I deleted and re-added my subform, tried it in
Visual Basic code instead of the macro, renamed, etc...
and nothing works. I have my control listed just as it is
on the properties window under control source, without
brackets or quotes. Any thoughts on what I can do to fix
this?
 
It's really difficult to do remote debugging, at best. It is impossible
without knowing the details of what you are trying to do and what you are
doing that doesn't work.

I'd say post the code... that would be best, as I haven't used macros except
for AutoExec and AutoKeys in a long, long time... but I see you mention you
are using a Macro. Maybe if you describe in detail, someone will step in.

Or maybe you could post the code that you tried that did not work.

I don't understand what you mean by "Macro that would first run my query and
then requery my subform"... what query would that be? I'm wondering why you
chose the Click event, too, as I might click in a Combo just to put the
cursor in place for typing. It is generally best to put actions in the
AfterUpdate event if you want to perform them when the content of the Combo
is changed. Is the Subform linked to the main form using the
LinkMasterFields and LinkChildFields properties of the Combo? If so, you
wouldn't need to Requery it if the LinkMasterFields changed; it would be
automatic.

Larry Linson
Microsoft Access MVP
 
Here's the code I used in VB:


Private Sub Combo20_Click()
DoCmd.SetWarnings Off
Echo Off
DoCmd.OpenQuery "qrySpDialReq"
DoCmd.OpenQuery "qryRotateReq"
DoCmd.Requery "Special Dialer Request Subform"
DoCmd.Requery "Rotate Request Subform"

End Sub


The Combo box has a list of manager names. You wouldn't
put your cursor there to type, you would click a drop down
list of names. After that, I want it to run my query for
any current requests they have and update the subform.
There are two different queries and two different subforms
I need to update. The requery function doesn't recognize
either subform.

Access won't let me LinkMasterFields because the forms are
all unbound.

Thoughts?

Mia
 
you might want to make sure that if you are using a macro
when you are refrenceing the subform you use the correct
syntax for example the syntax for "Special Dialer Request
Subform" if it is a subform within "Rotate Request
Subform" would be [forms]![rotate request subform]!
[special dialer request].[form] another option would be
to put the requery command (macro) on a timer that
refreshes every minute or so
 
Back
Top