Refresh method in VB doesn't pull most recent records

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
 
M

Michel Walsh

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
 

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

Top