Updating Form

  • Thread starter Thread starter Lamar
  • Start date Start date
L

Lamar

I have a form opened. I hit a cmd button that runs a query
that deletes some records in the underlining table for the
form.

I need to update the form information. Refreshing data is
not working. The only way I an able to "refresh the data"
is close and open the form or to manually go to design
view then back to normal. Neither one of these is
acceptable.

Is there some other way to do this in Visual Basic? Or at
least in VB automatically switch the form to design view
then back to normal view? Thanks for any help.
 
Lamar said:
I have a form opened. I hit a cmd button that runs a query
that deletes some records in the underlining table for the
form.

I need to update the form information. Refreshing data is
not working. The only way I an able to "refresh the data"
is close and open the form or to manually go to design
view then back to normal. Neither one of these is
acceptable.


"Refreshing data is not working" is doubly vague.

If "not working" means the deleted records still appear and
if "refreshing" means you used the Refresh method, then you
should use Requery instead.

OTOH, I can't see your code, so some of the problem may have
something to do with how you're running the query (RunSQL
may not complete by the time you do the "Refresh"). I
suggest the code should look something like:

Dim db As DAO.Database
Set db = CurrentDb()
db.Execute "DELETE * FROM thetable WHERE . . ."
Set db = Nothing
Me.Requery
 
Back
Top