Update to Link tables

  • Thread starter Thread starter Glen Hong
  • Start date Start date
G

Glen Hong

Hi I need a bit of help.

I am running Access 2003. I have an Access DB (front-end) accessing
another Access DB (back-end).

I have a form with a 3rd party grid control on it. The grid is
populated by creating an ADO recordset and then assigning it to the
grid.

The grid is readonly on the form. When I want to edit the grid I
double click a row and another form is popped up in modal. The form
is bound to a linked table i.e. Form.Recordsource.

When I edit the data on the form and I close it. I do basically 3
things.

1/ Manually save the record with DoMenuItem.
2/ Close the form. This should force a save as well.
3/ Then rebind the grid by refetching the data

The problem is that the code seems to be too quick. When I refetch
the data it seems the update to the linked table hasn't completed
because the data is still the same. If I put a breakpoint in to slow
it down it works and the data is refreshed.

I could put a delay in put I dont think this is necessary. Am I
missing something. Is there some option to update instantly?? Or is
there something else.

Appreciate any help anyone has to offer.

thanks
 
If this were DAO, I'd recommend trying a DbEngine.Idle between saving the
record and binding the grid. As far as I'm aware, though, ADO doesn't have
an equivalent method? What if you set the grid's Connection to Nothing and
then re-instantiate and open it? Does that fix the problem?
 
Have you tried doing the record update in VBA using an ADO recordset as
opposed to binding the modal form? This is cleaner in many ways and will
mean you're not relying on Access objects to save records etc. I would
separate the code which populates the grid either in a standard module or
public in the grid-form's module, calling that sub once you have updated the
record. Then you can do away with things like DoMenuItem which seems like an
unnecessary step.
 

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

Back
Top