Smartin said:
Good Day All,
An easy one? If I have a RecordSet object, can I set a form's
RecordSource property using the RecordSet? How?
I feel like I am overlooking something obvious.
Guess I need to provide a little more information:
The form's RecordSource is established on the fly in code, so I can't
"hard code" it into the form's properties.
RecordSet is not a property of "form" (at least, not in A97).
Here's more background. First I get some search terms from the user and
create a query statement. Next I create a RecordSet using the query. The
form's RecordSource will be set one of two ways depending on how many
records are in the RecordSet. So I was thinking to create the RecordSet
first, count the records, then set the form's RecordSource accordingly.
Alternatively I could skip the RecordSet and set the form's RecordSource
property using the constructed query and do some other things based on
how many records wind up in the form's "RecordSet". To do this I will
need a way to count the records, but I'm failing to figure out how this
is done either.
As it is I am currently getting the RecordSet with
Set RCD = CurrentDb.OpenRecordset(Query)
and then setting the form's RecordSource (sometimes) with
MyForm.RecordSet = Query
.... which means I am running the query twice. I am hoping to avoid this.