Remove a Query from the RowSource of a list box

G

Guest

2003/XP/Novice

Good Evening
When I open my form, the first line of code below puts a Select query into
the rowSource of a list box on the subform: fsubSelectRecord. This works OK.

Private Sub Form_Open(Cancel As Integer)
Me!fsubSelect.Form!lstSelectRecord.RowSource = "qrySelectPageOrder"
'make the combo the same as the destination
Me.cboLocalDestination = Me!LocalDestinationID
'prevent the "The OLE object is empty" error message
'by setting focus on a control on the main form
Me.cboLocalDestination.SetFocus
'Me.Refresh
Me!fsubSelect.Form!lstSelectRecord.Requery
End Sub

When I close the form, the line of code below is supposed to remove the
query from the RowSource.

Private Sub Form_Close()
Me!fsubSelect.Form!lstSelectRecord.RowSource = ""
End Sub

But I get the error:
Run time error '2445'
You entered an expression that has an invalid reference to the property
Form/Report.

I am want to null the RecordSource because the subform is used with multiple
forms and I load a different query with each form.

Thank you

Peter
 
G

Guest

Sorry this has been posted twice, but I got an error message indicating the
post had failed. Please reply to the post below this one.

Thanks

Peter
 

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