docmd.requery

  • Thread starter Thread starter Keith
  • Start date Start date
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.
 
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.
 
Back
Top