Refresh method in VB doesn't pull most recent records

  • Thread starter Thread starter Sam
  • Start date Start date
S

Sam

Hi--

I'm trying to automate the updating of several queries in an Excel 2003 file
via VB. The queries tie to an Access database. I'm using the following code
to do so (tied to a command button):

Selection.QueryTable.Refresh BackgroundQuery:=False

The data refreshes, but the results are different than when I hit the
exclamation button in Excel itself. The exclamation button's results are
accurate, while the VB's results aren't. Can someone tell me why this is
taking place?

Thanks,
Sam
 
A Recalc recomputes the expression of the form,
A Refresh reads again the values for the existing record(s) from the
database
A Requery reloads the recordset to take account of records added by
'others', but destroy bookmarks (since new records may have been inserted).


Vanderghast, Access MVP
 
Back
Top