xp310
asked on
Query: Criteria Row to Equal Value in Text Box
Hello,
On my main form, I currently have 3 subforms.
Subform 1: Active
Subform 2: DeActive
Subform 3: Other
Each subform points to the same data source, but the only thing different in each one is in the criteria row, I have either "Active" or "DeActive" or etc...
This way, each subform will only show a records within a specific status. Well, I'm a bit annoyed having 3 subforms on this form. I would imagine, I can avoid all this with my idea.
Is there any way, to put some code into the criteria row - that basically points it to a text box on my form that contains the value.
For example... My plan is to have 1 subform. Above that, I want a combo box that contains the 3 values (Active being the default value...)
Then when the subform is generated, in the status column it looks for the value of say, "cboStatus" and puts that value into the criteria row.
Does this make sense?
P.S. I know how to make the subform refresh, I just need it to know where to find the value for the criteria row...
Thank you in advance.
On my main form, I currently have 3 subforms.
Subform 1: Active
Subform 2: DeActive
Subform 3: Other
Each subform points to the same data source, but the only thing different in each one is in the criteria row, I have either "Active" or "DeActive" or etc...
This way, each subform will only show a records within a specific status. Well, I'm a bit annoyed having 3 subforms on this form. I would imagine, I can avoid all this with my idea.
Is there any way, to put some code into the criteria row - that basically points it to a text box on my form that contains the value.
For example... My plan is to have 1 subform. Above that, I want a combo box that contains the 3 values (Active being the default value...)
Then when the subform is generated, in the status column it looks for the value of say, "cboStatus" and puts that value into the criteria row.
Does this make sense?
P.S. I know how to make the subform refresh, I just need it to know where to find the value for the criteria row...
Thank you in advance.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
urm, code supplied is for mainform
if u want button on subform, u simply do this
private sub cboStatus_AfterUpdate
Me.Filter = "Status = " & me.Parent.cboStatus
Me.FilterOn = True
end sub
this also assumes the field in the subform is called Status
if u want button on subform, u simply do this
private sub cboStatus_AfterUpdate
Me.Filter = "Status = " & me.Parent.cboStatus
Me.FilterOn = True
end sub
this also assumes the field in the subform is called Status
ASKER
OM Gang,
Your solution worked perfectly. Thank you very much for you time.
Jay
Your solution worked perfectly. Thank you very much for you time.
Jay
You're welcome. Thank you.
OM Gang
OM Gang
u could try this
private sub cboStatus_AfterUpdate
Me.mysubform.Form.Filter = "Status = " & cboStatus
Me.mysubform.Form.FilterOn
end sub
Assuming status is numeric