Error 2118 when requerying subform

E

er2

Hello,

I keep running into the infamous error 2118 when trying to requery my
subforms. I have been browsing usenet and the web for hours, but
without success so far.

Situation: I have a blank form that serves as a dashboard, which in
return has two subforms used to visualise data. The dashboard has a
number of controls used to set certain values (e.g. selected segments,
reference date etc) which are then stored in tables (this works). The
subforms visualise data that comes from a select query which includes
joins on these aforementioned tables (i.e., the select query will
display the data for the correct reference date). Upon, for example,
changing the reference date I want to
- update it in the table
- requery the subform (or some chart in the subform) to display the
select query's results.

e.g.
Private Sub refDateMF_AfterUpdate()
DoCmd.RunSQL "update infr_current_ref_period_lmt set refDate = " &
refDateMF & ";"
Me.subform_Overview.Form.requeryForm
Me.subform_Details.Form.requeryForm
End Sub

in the subform:
Public Sub requeryForm()
Me.globalChart.Requery
End Sub


At this point, I get the error 2118 - save data first etc message. Fun
fact: If I remove the .requery-part, but insert a button into the
subform from which I call the me.globalChart.Requery manually, it
works like a charm. Can someone explain what I am doing wrong here?
FWIW, I've tried all the if me.dirty then me.dirty=false and it did
not help....
Thanks in advance
 
D

David-W-Fenton

m:
FWIW, I've tried all the if me.dirty then me.dirty=false and it
did not help....

Where? Before you run the SQL update?

Why are you using a SQL update when you've got the data displayed in
a form? Is the form unbound or not?

Your approach is definitely not consistent with the normal Access
way of doing things, and this is likely the source of your problems
-- you're making it too hard for yourself.
 

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