Order of execution mystery

  • Thread starter Thread starter caagaard
  • Start date Start date
C

caagaard

Hi,

I have a form with some graphs. I also have a command button that refreshes
the data in a particular graph named CH_VAR_TYPE_GROUP. Besides the requery,
a click on the button should also update the name of the first data series in
the data sheet with a new title ("New title"). Here is the code:

Private Sub Generate_objects_Click()

Me.CH_VAR_TYPE_GROUP.Requery

Set gchart = CH_VAR_TYPE_GROUP.Object
gchart.Application.DataSheet.Range("A0").Value = "New Title"
gchart.Refresh

End Sub

The problem with this is that no matter how I arrange the code, the requery
is done as the last thing and this means that my change of title in the data
sheet is overwritten! This happens even though the requery appears as the
first thing in the code or even if the requery code is put in another sub and
then called from the button code. Why is this the case and is there a way to
work around this problem? (without seperating the two "actions" completely -
eg. two different command buttons)

Thanks in advance
 
Check the Refresh and Repaint methods as well (MS Help explains well enough
on these). Requery, Refresh and Repaint all fall in the same catagory more
or less, but work on different "levels" Refresh will refresh the data
without requering, Repaint updates the screen without refreshing data, etc.,
so between these three you may be able to find a combination that works.

hth
--
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)
 
Hi,

I actually have tried with the different methods, but the problem is that I
need an actual requery of the data from the database (it is a pass throuh
query that obtains data from an Oracle Database). For this purpose, refresh
and repaint won't do the job and I am stuck with the problem that requery
executes as the last thing no matter how I arrange it
 
Back
Top