Search and update data

G

Guest

I am trying (in vane) to get a basic db function. Search for a record and
allow the user to update it once it is found.
I do not want to use the basic Filter By Form feature as there are too many
records in the drop downs to make this practical.

The functionality I need is to have the end user be able to search for a
record using a keyword and have all records matching that keyword appear in
the form much like what happens when the Filter By Form feauture is used.

A query based on a form for the keyword returns the table view - not
acceptable.

Any help is appreciated.
 
G

Guest

John,

Place an unbound textbox (txt_Filter) in the forms header and add a command
button (cmd_Filter) next to it. You might even want to add a second button
(cmd_Clear_Filter) next to that.

In the Click event of the command button enter the following code.

Private sub cmd_Filter_Click

Dim strFilter as string
strFilter = "[field1] Like '*" & me.txt_Filter & "*'"
'you can expand this to multiple fields if you'd like

me.Filter = strFilter
me.FilterOn = True

End Sub

Private sub cmd_Clear_Filter_Click()

me.FilterOn = False

End Sub

HTH
Dale
 
M

Marshall Barton

John said:
I am trying (in vane) to get a basic db function. Search for a record and
allow the user to update it once it is found.
I do not want to use the basic Filter By Form feature as there are too many
records in the drop downs to make this practical.

The functionality I need is to have the end user be able to search for a
record using a keyword and have all records matching that keyword appear in
the form much like what happens when the Filter By Form feauture is used.

A query based on a form for the keyword returns the table view - not
acceptable.


Presumable you have a form to display the data. If so, this
commonly done by using a text box in the form's header
section for users to enter a keyword. Then the text box's
AfterUpdate event can set the form's Filter something like:

Me.Filter="[field to search]=""" & Me.[the text box] & """"
Me.FilterOn = True
 
G

Guest

This worked perfectly (once i fixed my typo causing a 2448 runtime error)
Type carefully people.

Thanks Dale

Dale Fye said:
John,

Place an unbound textbox (txt_Filter) in the forms header and add a command
button (cmd_Filter) next to it. You might even want to add a second button
(cmd_Clear_Filter) next to that.

In the Click event of the command button enter the following code.

Private sub cmd_Filter_Click

Dim strFilter as string
strFilter = "[field1] Like '*" & me.txt_Filter & "*'"
'you can expand this to multiple fields if you'd like

me.Filter = strFilter
me.FilterOn = True

End Sub

Private sub cmd_Clear_Filter_Click()

me.FilterOn = False

End Sub

HTH
Dale




--
Email address is not valid.
Please reply to newsgroup only.


John said:
I am trying (in vane) to get a basic db function. Search for a record and
allow the user to update it once it is found.
I do not want to use the basic Filter By Form feature as there are too many
records in the drop downs to make this practical.

The functionality I need is to have the end user be able to search for a
record using a keyword and have all records matching that keyword appear in
the form much like what happens when the Filter By Form feauture is used.

A query based on a form for the keyword returns the table view - not
acceptable.

Any help is appreciated.
 
G

Guest

I thought I could do without but it is becomming apperant that I need to have
the search look across multiple fields as you suggested. What is the syntax
for expanding it to multiple fields? "OR" did not work and adding an
identical line (w/ field name changed) did not work (just looked in one
field).

Thanks

Dale Fye said:
John,

Place an unbound textbox (txt_Filter) in the forms header and add a command
button (cmd_Filter) next to it. You might even want to add a second button
(cmd_Clear_Filter) next to that.

In the Click event of the command button enter the following code.

Private sub cmd_Filter_Click

Dim strFilter as string
strFilter = "[field1] Like '*" & me.txt_Filter & "*'"
'you can expand this to multiple fields if you'd like

me.Filter = strFilter
me.FilterOn = True

End Sub

Private sub cmd_Clear_Filter_Click()

me.FilterOn = False

End Sub

HTH
Dale




--
Email address is not valid.
Please reply to newsgroup only.


John said:
I am trying (in vane) to get a basic db function. Search for a record and
allow the user to update it once it is found.
I do not want to use the basic Filter By Form feature as there are too many
records in the drop downs to make this practical.

The functionality I need is to have the end user be able to search for a
record using a keyword and have all records matching that keyword appear in
the form much like what happens when the Filter By Form feauture is used.

A query based on a form for the keyword returns the table view - not
acceptable.

Any help is appreciated.
 
D

Dale Fye

John,

Try:

strFilter = "[field1] Like '*" & me.txt_Filter & "*' OR "_
& "[Field2] Like '*" & me.txt_Filter & "*' OR " _
& "[Field3] Like '*" & me.txt_Filter & "*' "

HTH
Dale


John said:
I thought I could do without but it is becomming apperant that I need to
have
the search look across multiple fields as you suggested. What is the
syntax
for expanding it to multiple fields? "OR" did not work and adding an
identical line (w/ field name changed) did not work (just looked in one
field).

Thanks

Dale Fye said:
John,

Place an unbound textbox (txt_Filter) in the forms header and add a
command
button (cmd_Filter) next to it. You might even want to add a second
button
(cmd_Clear_Filter) next to that.

In the Click event of the command button enter the following code.

Private sub cmd_Filter_Click

Dim strFilter as string
strFilter = "[field1] Like '*" & me.txt_Filter & "*'"
'you can expand this to multiple fields if you'd like

me.Filter = strFilter
me.FilterOn = True

End Sub

Private sub cmd_Clear_Filter_Click()

me.FilterOn = False

End Sub

HTH
Dale




--
Email address is not valid.
Please reply to newsgroup only.


John said:
I am trying (in vane) to get a basic db function. Search for a record
and
allow the user to update it once it is found.
I do not want to use the basic Filter By Form feature as there are too
many
records in the drop downs to make this practical.

The functionality I need is to have the end user be able to search for
a
record using a keyword and have all records matching that keyword
appear in
the form much like what happens when the Filter By Form feauture is
used.

A query based on a form for the keyword returns the table view - not
acceptable.

Any help is appreciated.
 
G

Guest

It works - Thanks again Dale.

Dale Fye said:
John,

Try:

strFilter = "[field1] Like '*" & me.txt_Filter & "*' OR "_
& "[Field2] Like '*" & me.txt_Filter & "*' OR " _
& "[Field3] Like '*" & me.txt_Filter & "*' "

HTH
Dale


John said:
I thought I could do without but it is becomming apperant that I need to
have
the search look across multiple fields as you suggested. What is the
syntax
for expanding it to multiple fields? "OR" did not work and adding an
identical line (w/ field name changed) did not work (just looked in one
field).

Thanks

Dale Fye said:
John,

Place an unbound textbox (txt_Filter) in the forms header and add a
command
button (cmd_Filter) next to it. You might even want to add a second
button
(cmd_Clear_Filter) next to that.

In the Click event of the command button enter the following code.

Private sub cmd_Filter_Click

Dim strFilter as string
strFilter = "[field1] Like '*" & me.txt_Filter & "*'"
'you can expand this to multiple fields if you'd like

me.Filter = strFilter
me.FilterOn = True

End Sub

Private sub cmd_Clear_Filter_Click()

me.FilterOn = False

End Sub

HTH
Dale




--
Email address is not valid.
Please reply to newsgroup only.


:

I am trying (in vane) to get a basic db function. Search for a record
and
allow the user to update it once it is found.
I do not want to use the basic Filter By Form feature as there are too
many
records in the drop downs to make this practical.

The functionality I need is to have the end user be able to search for
a
record using a keyword and have all records matching that keyword
appear in
the form much like what happens when the Filter By Form feauture is
used.

A query based on a form for the keyword returns the table view - not
acceptable.

Any help is appreciated.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top