Filter for user defined records

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

Guest

Is there a way to set up a button so that when its clicked the user can
specify what they are looking for? i.e. the user wants to find records that
contain "as in" it so they would type in *as in* and then all records with
"as in" would be the only ones showing?
 
Filter-by-Form (toolbar button) does that.

You can also code it if you want. This example show how to filter the form
so it shows only records where Field1 contains the text the user typed into
the text box Text2Find:

If Not IsNull(Me.Text2Find) Then
If Me.Dirty Then Me.Dirty = False 'Save first.
Me.Filter = "[Field1] Like """ & Me.Text2Find & """"
Me.FilterOn = True
End If
 
Thank you for the information Allen. My users are VERY limited in their
knowledge of applications let alone Access. I created a button using the
code below however when you click the button a compile error: Method or data
member not found

If Not IsNull(Me.text2find) Then
If Me.Dirty Then Me.Dirty = False 'Save first.
Me.Filter = "[sessionname] Like """ & Me.text2find & """"
Me.FilterOn = True
End If
End Sub


I am thinking that I need to call up the Filter For: box? Is there a way to
do this if this is my problem?

Allen Browne said:
Filter-by-Form (toolbar button) does that.

You can also code it if you want. This example show how to filter the form
so it shows only records where Field1 contains the text the user typed into
the text box Text2Find:

If Not IsNull(Me.Text2Find) Then
If Me.Dirty Then Me.Dirty = False 'Save first.
Me.Filter = "[Field1] Like """ & Me.Text2Find & """"
Me.FilterOn = True
End If

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

dc said:
Is there a way to set up a button so that when its clicked the user can
specify what they are looking for? i.e. the user wants to find records
that
contain "as in" it so they would type in *as in* and then all records with
"as in" would be the only ones showing?
 
Do you have an *unbound* text box named txt2find?

Is there a field named sessionname in the table/query that feeds this form?

If you open the table in design view, is the sessionsname field a Text type
field? (If it is number, the extra quotes have to go.)

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

dc said:
Thank you for the information Allen. My users are VERY limited in their
knowledge of applications let alone Access. I created a button using the
code below however when you click the button a compile error: Method or
data
member not found

If Not IsNull(Me.text2find) Then
If Me.Dirty Then Me.Dirty = False 'Save first.
Me.Filter = "[sessionname] Like """ & Me.text2find & """"
Me.FilterOn = True
End If
End Sub


I am thinking that I need to call up the Filter For: box? Is there a way
to
do this if this is my problem?

Allen Browne said:
Filter-by-Form (toolbar button) does that.

You can also code it if you want. This example show how to filter the
form
so it shows only records where Field1 contains the text the user typed
into
the text box Text2Find:

If Not IsNull(Me.Text2Find) Then
If Me.Dirty Then Me.Dirty = False 'Save first.
Me.Filter = "[Field1] Like """ & Me.Text2Find & """"
Me.FilterOn = True
End If

dc said:
Is there a way to set up a button so that when its clicked the user can
specify what they are looking for? i.e. the user wants to find records
that
contain "as in" it so they would type in *as in* and then all records
with
"as in" would be the only ones showing?
 
Thank you Allen, I didnt have the unbound text box. Is there a way to make
this a popup style instead of a constant field?

Allen Browne said:
Do you have an *unbound* text box named txt2find?

Is there a field named sessionname in the table/query that feeds this form?

If you open the table in design view, is the sessionsname field a Text type
field? (If it is number, the extra quotes have to go.)

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

dc said:
Thank you for the information Allen. My users are VERY limited in their
knowledge of applications let alone Access. I created a button using the
code below however when you click the button a compile error: Method or
data
member not found

If Not IsNull(Me.text2find) Then
If Me.Dirty Then Me.Dirty = False 'Save first.
Me.Filter = "[sessionname] Like """ & Me.text2find & """"
Me.FilterOn = True
End If
End Sub


I am thinking that I need to call up the Filter For: box? Is there a way
to
do this if this is my problem?

Allen Browne said:
Filter-by-Form (toolbar button) does that.

You can also code it if you want. This example show how to filter the
form
so it shows only records where Field1 contains the text the user typed
into
the text box Text2Find:

If Not IsNull(Me.Text2Find) Then
If Me.Dirty Then Me.Dirty = False 'Save first.
Me.Filter = "[Field1] Like """ & Me.Text2Find & """"
Me.FilterOn = True
End If

Is there a way to set up a button so that when its clicked the user can
specify what they are looking for? i.e. the user wants to find records
that
contain "as in" it so they would type in *as in* and then all records
with
"as in" would be the only ones showing?
 
If you want a pop up form instead of a text box on your actual form, replace
the whole thing with:
RunCommand acCmdFind

If you want a drop-down list (combo) instead of a text box, the code is the
same.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

dc said:
Thank you Allen, I didnt have the unbound text box. Is there a way to
make
this a popup style instead of a constant field?

Allen Browne said:
Do you have an *unbound* text box named txt2find?

Is there a field named sessionname in the table/query that feeds this
form?

If you open the table in design view, is the sessionsname field a Text
type
field? (If it is number, the extra quotes have to go.)

dc said:
Thank you for the information Allen. My users are VERY limited in
their
knowledge of applications let alone Access. I created a button using
the
code below however when you click the button a compile error: Method or
data
member not found

If Not IsNull(Me.text2find) Then
If Me.Dirty Then Me.Dirty = False 'Save first.
Me.Filter = "[sessionname] Like """ & Me.text2find & """"
Me.FilterOn = True
End If
End Sub


I am thinking that I need to call up the Filter For: box? Is there a
way
to
do this if this is my problem?

:

Filter-by-Form (toolbar button) does that.

You can also code it if you want. This example show how to filter the
form
so it shows only records where Field1 contains the text the user typed
into
the text box Text2Find:

If Not IsNull(Me.Text2Find) Then
If Me.Dirty Then Me.Dirty = False 'Save first.
Me.Filter = "[Field1] Like """ & Me.Text2Find & """"
Me.FilterOn = True
End If

Is there a way to set up a button so that when its clicked the user
can
specify what they are looking for? i.e. the user wants to find
records
that
contain "as in" it so they would type in *as in* and then all
records
with
"as in" would be the only ones showing?
 
Thank you for all of your help.

Allen Browne said:
If you want a pop up form instead of a text box on your actual form, replace
the whole thing with:
RunCommand acCmdFind

If you want a drop-down list (combo) instead of a text box, the code is the
same.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

dc said:
Thank you Allen, I didnt have the unbound text box. Is there a way to
make
this a popup style instead of a constant field?

Allen Browne said:
Do you have an *unbound* text box named txt2find?

Is there a field named sessionname in the table/query that feeds this
form?

If you open the table in design view, is the sessionsname field a Text
type
field? (If it is number, the extra quotes have to go.)

Thank you for the information Allen. My users are VERY limited in
their
knowledge of applications let alone Access. I created a button using
the
code below however when you click the button a compile error: Method or
data
member not found

If Not IsNull(Me.text2find) Then
If Me.Dirty Then Me.Dirty = False 'Save first.
Me.Filter = "[sessionname] Like """ & Me.text2find & """"
Me.FilterOn = True
End If
End Sub


I am thinking that I need to call up the Filter For: box? Is there a
way
to
do this if this is my problem?

:

Filter-by-Form (toolbar button) does that.

You can also code it if you want. This example show how to filter the
form
so it shows only records where Field1 contains the text the user typed
into
the text box Text2Find:

If Not IsNull(Me.Text2Find) Then
If Me.Dirty Then Me.Dirty = False 'Save first.
Me.Filter = "[Field1] Like """ & Me.Text2Find & """"
Me.FilterOn = True
End If

Is there a way to set up a button so that when its clicked the user
can
specify what they are looking for? i.e. the user wants to find
records
that
contain "as in" it so they would type in *as in* and then all
records
with
"as in" would be the only ones showing?
 
Back
Top