docmd.requery

K

Keith

I have a field (ResApt) in a form whose row source is a
different query (qryResAptList) than the data source of
the form. When ResApt get the focus I would like to
refresh qryResAptList. However, when I click on ResApt I
get an error. I am using the following:

Private Sub ResApt_GotFocus()
ResApt.RecordSource = "qryResAptList"
DoCmd.Requery "qryResAptList"
End Sub

Any thoughts? Thanx.
 
M

Marshall Barton

Keith said:
I have a field (ResApt) in a form whose row source is a
different query (qryResAptList) than the data source of
the form. When ResApt get the focus I would like to
refresh qryResAptList. However, when I click on ResApt I
get an error. I am using the following:

Private Sub ResApt_GotFocus()
ResApt.RecordSource = "qryResAptList"
DoCmd.Requery "qryResAptList"


I presume that ResApt is a combo or list box, if so, then
you should be setting its RowSource. There is no need to
requery it after setting its RowSource.

OTOH, if all you want to do is requery it, then you don't
have to set its RowSource.
 

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