[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 314
  • Last Modified:

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.
0
xp310
Asked:
xp310
  • 2
  • 2
1 Solution
 
omgangCommented:
Forms!MainForm!cboStatus

OM Gang
0
 
rockiroadsCommented:
am I right, one subform, but filtered different on flag?

u could try this

private sub cboStatus_AfterUpdate

    Me.mysubform.Form.Filter = "Status = " & cboStatus
    Me.mysubform.Form.FilterOn = True
end sub


Assuming status is numeric
0
 
rockiroadsCommented:
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
0
 
xp310Author Commented:
OM Gang,

Your solution worked perfectly.  Thank you very much for you time.

Jay
0
 
omgangCommented:
You're welcome.  Thank you.

OM Gang
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now