Changing a forms record source

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I know there's a simple way to do this, but I haven't been able to figure it
out. I would either like to have a command button to change record sources,
or have the record source dependent upon a value in an unbound combo box used
to filter records. So in other words, if the filter selection is "all
records" then there is one record source, but if the filter selection is
"criteria 1" or "criteria 2", then the form looks to another record source.

Can you help?
 
If it on the same form

Me.RecordSource = "Select * from TableName"
Me.Requery

Should do it
 
Assuming you are still requerying the same query/table then On the buttons
OnClick event set the form recordsource to whatever you want and requery.

me.recordsource = "whatever the record selection criteria now is"
me.requery

Or if all you are trying to do is set a filter depending on your buttons

me.filter = yourfilter criteria (remember this is a text string)
me.filteron = true
 
Back
Top