Can't get requery to work

R

RobUCSD

I need the query that my form is based on to requery once the new data is
saved. below is what I've tried (see DoCmd.Requery qryVisitList).

Any help would be much appreciated.
Thanks, RobUCSD

Private Sub cboSaveVisitRecord_Click()
On Error GoTo Err_cboSaveVisitRecord_Click


DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.Requery qryVisitList

Exit_cboSaveVisitRecord_Click:
Exit Sub

Err_cboSaveVisitRecord_Click:
MsgBox Err.Description
Resume Exit_cboSaveVisitRecord_Click

End Sub
 
K

Ken Snell \(MVP\)

Change this code line:
DoCmd.Requery qryVisitList

to this:
Me.Requery
 
R

RobUCSD

thanks for your response. i've tried that. I have a lsitbox on the form that
I need updated when the visit record saves. It is also based on qryVisitList.
I thought requerying the qryVisitList would also cause the listbox to update.
Any Ideas?
Thanks,
RobUCSD
 
K

Ken Snell \(MVP\)

Sorry - I was thinking the query was the form's RecorsSource. Use this line
of code (change ListBoxName to the real name of the listbox):

Me.ListBoxName.Requery
 

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