Event to set Record Source of SubForm

S

Sandy

Hello -

How do I code an Event to change the Record Source of a subform?

Thanks
sandra
 
S

Sandy

Sorry - I figured it out. I created the queries I wanted then programmed 2
buttons to apply the SQL to my record source as follows:

Private Sub ShowAllBut_Click()

Dim stFilterSQL As String
stFilterSQL = "the SQL view of my query here"
Me.RecordSource = stFilterSQL
Me.Requery
End Sub

Sorry for the bother!
 
M

Marshall Barton

Sandy said:
Sorry - I figured it out. I created the queries I wanted then programmed 2
buttons to apply the SQL to my record source as follows:

Private Sub ShowAllBut_Click()

Dim stFilterSQL As String
stFilterSQL = "the SQL view of my query here"
Me.RecordSource = stFilterSQL
Me.Requery
End Sub


That's good.

Just one comment though. Using Requery here is a waste of
processing because setting the RecordSource automatically
takes care of that.
 

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