change recordset

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

Guest

I've got a sub-form inside a form for which I want to change the recordset
from within VBA. (The sub-form has no recordset for itself and I wish to use
the same sub-form for several different queries, depending on which button is
pressed).

The line I currently am trying is

Me!pos_in.Recordset = "pos_same" where pos_in is the subform and "pos_name"
is the query I wish to use. The system rejects this line, but it likes

Me!pos_in.SourceObject = "pos_in_fimat"

which apparently changes the sub-form, not the recordset. How can I change
the recordset associated with that sub-form? TIA.....
 
I've got a sub-form inside a form for which I want to change the recordset
from within VBA. (The sub-form has no recordset for itself and I wish to use
the same sub-form for several different queries, depending on which button is
pressed).

The line I currently am trying is

Me!pos_in.Recordset = "pos_same" where pos_in is the subform and "pos_name"
is the query I wish to use. The system rejects this line, but it likes

Me!pos_in.SourceObject = "pos_in_fimat"

which apparently changes the sub-form, not the recordset. How can I change
the recordset associated with that sub-form? TIA.....

I think you want

Me!pos_in.Form.Recordsource = "pos_name"

The Source Object is the name of a Form used within the subform control; that
Form has a Recordsource (not Recordset!) property which is the name of a
table, of a query, or is a SQL string.

John W. Vinson [MVP]
 
J. Freed said:
I've got a sub-form inside a form for which I want to change the recordset
from within VBA. (The sub-form has no recordset for itself and I wish to use
the same sub-form for several different queries, depending on which button is
pressed).

The line I currently am trying is

Me!pos_in.Recordset = "pos_same" where pos_in is the subform and "pos_name"
is the query I wish to use. The system rejects this line, but it likes

Me!pos_in.SourceObject = "pos_in_fimat"

which apparently changes the sub-form, not the recordset. How can I change
the recordset associated with that sub-form? TIA.....


Me!pos_in.Form.RecordSource = "pos_same"
 
Back
Top