Full Version: Relead/Refresh Form
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
piper3d
I have a form which stores it's data in a table. This is standard. I have created a delete query that deletes all of the records from that table. I put a button in the form header that runs the delete query. This works fine.

What doesn't happen is that the form does not get reloaded/refreshed so the contents still show on the form even though they have been deleted. If you click on a record it changes the record and says deleted.

How can I make it so that the screen does a refresh so it gets rid of the deleted records and shows the blank form again?

Basically I want a delete all records from the form and refresh the page.

Any idea's?

Thanks in advance,
Brian Weber
fkegley
In the code for the button, after the delete query runs, you need

Me.Requery
piper3d
I tried that. It does not work.

Here is the code for the button. It is an on click event.

Private Sub Command26_Click()
On Error GoTo Err_Command26_Click

Dim stDocName As String

stDocName = "qryITEMS01_D"
DoCmd.OpenQuery stDocName, acNormal, acEdit
Me.Requery

Exit_Command26_Click:
Exit Sub

Err_Command26_Click:
MsgBox Err.Description
Resume Exit_Command26_Click

End Sub

Brian Weber
fkegley
I did it like this:

Dim stDocName As String
stDocName = "Query12"
DoCmd.OpenQuery stDocName, acNormal, acEdit

DoCmd.Close
DoCmd.OpenForm "CopyOfCategories"
piper3d
It's working now.

Silly me, I was editing code for another button by mistake.

The me.requery works too.

Thanks for the help.

Brian Weber
fkegley
You're welcome.
natashaepperson
Nevermind =)

i got it, I looked at some of your older posts =)

Private Sub Refresh_Click()
Dim stDocName As String
stDocName = "qry_PO_Master"
Me.Requery

End Sub
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.