VBA coding for msg box, close form, open table

  • Thread starter Thread starter JR
  • Start date Start date
J

JR

I have some workable code under a command button that runs
20 sequential append queries.

It works BUT it takes a while and I would like to do two
things:

1) Let the user know that the queries are working (with a
MsgBox: The query will run when you select the OK button
below. When the query is finished the table will be
displayed.

2) Display the table and close the form when the queries
are finished running.

I haven't the slightest idea on how to make those things
happen.

Can anyone out there help me?

Thanks!
 
Dim db As DAO.Database
If MsgBox("This'll take a while.", vbOkCancel) <> vbCancel Then
Set db = dbEngine(0)(0)
db.Execute "Query1", dbFailOnError
db.Execute "Query2", dbFailOnError
'etc.

DoCmd.OpenTable "Table1"
End If
Set db = Nothing
 
THANKS!

-----Original Message-----
Dim db As DAO.Database
If MsgBox("This'll take a while.", vbOkCancel) <> vbCancel Then
Set db = dbEngine(0)(0)
db.Execute "Query1", dbFailOnError
db.Execute "Query2", dbFailOnError
'etc.

DoCmd.OpenTable "Table1"
End If
Set db = Nothing

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.




.
 
Back
Top