filtering a form

P

Papa Jonah

I have a form which I would like to filter. I have a checkbox that I want to
use to filter the form by. If the checkbox is checked, I want the record to
appear - otherwise not.
I apparently don't understand this feature.
TIA

Papa
 
O

Ofer Cohen

It's not very clear what yo are asking for.

Is it to filter the form or make the records apear if the check box is
checked?

The records are on the form or SubForm

A code you can start with on the AfterUpdate event of the check box (if that
what you are looking for).

Assign a record source to the form, assuming you mean for a sub form

If Me.CheckBoxName = True Then
Me.[SubFormControlName].Form.RecordSource = "Select * From TableName"
Else
Me.[SubFormControlName].Form.RecordSource = ""
End If
Me.[SubFormControlName].Requery
 
O

Ofer Cohen

It will be better to assign a record source wth filter that doesnt return any
records, and not empty record source that might display #names# in the text
boxes.
Something like

If Me.CheckBoxName = True Then
Me.[SubFormControlName].Form.RecordSource = "Select * From TableName"
Else
Me.[SubFormControlName].Form.RecordSource = "Select * From TableName
Where KeyFieldName = Null"
End If
Me.[SubFormControlName].Requery
 
P

Papa Jonah

Ofer
I am not sure I understand your direction. I guess I do not understand the
filter aspect. You are correct that what I hope for is to only have records
show up in the form if the particular checkbox is checked. This is not in a
subform. Does that clarify?

Papa

Ofer Cohen said:
It's not very clear what yo are asking for.

Is it to filter the form or make the records apear if the check box is
checked?

The records are on the form or SubForm

A code you can start with on the AfterUpdate event of the check box (if that
what you are looking for).

Assign a record source to the form, assuming you mean for a sub form

If Me.CheckBoxName = True Then
Me.[SubFormControlName].Form.RecordSource = "Select * From TableName"
Else
Me.[SubFormControlName].Form.RecordSource = ""
End If
Me.[SubFormControlName].Requery


--
Good Luck
BS"D


Papa Jonah said:
I have a form which I would like to filter. I have a checkbox that I want to
use to filter the form by. If the checkbox is checked, I want the record to
appear - otherwise not.
I apparently don't understand this feature.
TIA

Papa
 
P

Papa Jonah

I have no idea what this means. Can you clarify this for me? What does this
mean "assign a record source"
"that doesn't return any records"?


Ofer Cohen said:
It will be better to assign a record source wth filter that doesnt return any
records, and not empty record source that might display #names# in the text
boxes.
Something like

If Me.CheckBoxName = True Then
Me.[SubFormControlName].Form.RecordSource = "Select * From TableName"
Else
Me.[SubFormControlName].Form.RecordSource = "Select * From TableName
Where KeyFieldName = Null"
End If
Me.[SubFormControlName].Requery



--
Good Luck
BS"D


Papa Jonah said:
I have a form which I would like to filter. I have a checkbox that I want to
use to filter the form by. If the checkbox is checked, I want the record to
appear - otherwise not.
I apparently don't understand this feature.
TIA

Papa
 
Top