PC Review


Reply
Thread Tools Rate Thread

Access 2010 - Form - Box "Search" in Navigation bar

 
 
ancucchi@gmail.com
Guest
Posts: n/a
 
      30th Aug 2012
I'm tryng to replicate the box in object that can filter the visualized data while I digitize searching in every field of the table.

I have realized something similar with this simple code that filter olny one field:
""""" Me.Filter = "[LastName] Like '*" & [ControlName] & "*'"
Me.FilterOn = True """""

But write the some code for hundreds filed become reaaly hard.

It's possible change [LastName] with something similar that mean [EVERY FIELD]?

Or other suggestions?

Tony from Sardinia (ITALY)
 
Reply With Quote
 
 
 
 
John W. Vinson
Guest
Posts: n/a
 
      30th Aug 2012
On Thu, 30 Aug 2012 02:44:42 -0700 (PDT), (E-Mail Removed) wrote:

>I'm tryng to replicate the box in object that can filter the visualized data while I digitize searching in every field of the table.
>
>I have realized something similar with this simple code that filter olny one field:
>""""" Me.Filter = "[LastName] Like '*" & [ControlName] & "*'"
> Me.FilterOn = True """""
>
>But write the some code for hundreds filed become reaaly hard.
>
>It's possible change [LastName] with something similar that mean [EVERY FIELD]?
>
>Or other suggestions?
>
>Tony from Sardinia (ITALY)


If you have hundreds of fields in your table - it's NOT properly
normalized!!!!

Short answer: No. Query criteria are field by field.

Longer answer: you can use VBA code to loop through the unbound controls on a
search form, constructing a SQL string containing criteria for those controls
in which the user entered something.

Could you explain the context? What's in the table? Why does it have hundreds
of fields?
--

John W. Vinson [MVP]
Microsoft's replacements for these newsgroups:
http://social.msdn.microsoft.com/For...-US/accessdev/
http://social.answers.microsoft.com/.../en-US/addbuz/
and see also http://www.utteraccess.com
 
Reply With Quote
 
 
 
 
ancucchi@gmail.com
Guest
Posts: n/a
 
      31st Aug 2012
That database manage clients of an enterprise and all their data.

My client asked specifically one box where write something for filter the all data... for example they write "MOKBA" and want see only the people birth in Mokba or living in Mokba or named Mokba and so on... exactly as the little search box in navigation bar do... only more bigger and inside the form...

Tony from Sardinia...

Il giorno giovedì 30 agosto 2012 18:18:37 UTC+2, John W. Vinson ha scritto:
> On Thu, 30 Aug 2012 02:44:42 -0700 (PDT), (E-Mail Removed) wrote:
>
>
>
> >I'm tryng to replicate the box in object that can filter the visualized data while I digitize searching in every field of the table.

>
> >

>
> >I have realized something similar with this simple code that filter olnyone field:

>
> >""""" Me.Filter = "[LastName] Like '*" & [ControlName] & "*'"

>
> > Me.FilterOn = True """""

>
> >

>
> >But write the some code for hundreds filed become reaaly hard.

>
> >

>
> >It's possible change [LastName] with something similar that mean [EVERY FIELD]?

>
> >

>
> >Or other suggestions?

>
> >

>
> >Tony from Sardinia (ITALY)

>
>
>
> If you have hundreds of fields in your table - it's NOT properly
>
> normalized!!!!
>
>
>
> Short answer: No. Query criteria are field by field.
>
>
>
> Longer answer: you can use VBA code to loop through the unbound controls on a
>
> search form, constructing a SQL string containing criteria for those controls
>
> in which the user entered something.
>
>
>
> Could you explain the context? What's in the table? Why does it have hundreds
>
> of fields?
>
> --
>
>
>
> John W. Vinson [MVP]
>
> Microsoft's replacements for these newsgroups:
>
> http://social.msdn.microsoft.com/For...-US/accessdev/
>
> http://social.answers.microsoft.com/.../en-US/addbuz/
>
> and see also http://www.utteraccess.com


 
Reply With Quote
 
John W. Vinson
Guest
Posts: n/a
 
      1st Sep 2012
On Thu, 30 Aug 2012 23:41:54 -0700 (PDT), (E-Mail Removed) wrote:

>My client asked specifically one box where write something for filter the all data...

for example they write "MOKBA" and want see only the people birth in Mokba or
living in Mokba or named Mokba and so on... exactly as the little search box
in navigation bar do... only more bigger and inside the form...

Well, you'll have to use VBA code to write the SQL then, and it won't be
trivial.

I honestly think this is a case where the customer is NOT necessarily right.
It makes no sense to me to search (say) a number or date field for text, or
even search a text field for unrelated text. "Mokba" only has meaning in a
context.
--

John W. Vinson [MVP]
Microsoft's replacements for these newsgroups:
http://social.msdn.microsoft.com/For...-US/accessdev/
http://social.answers.microsoft.com/.../en-US/addbuz/
and see also http://www.utteraccess.com
 
Reply With Quote
 
Bob Barrows
Guest
Posts: n/a
 
      2nd Sep 2012
(E-Mail Removed) wrote:
> I'm tryng to replicate the box in object that can filter the
> visualized data while I digitize searching in every field of the
> table.
>
> I have realized something similar with this simple code that filter
> olny one field: """"" Me.Filter = "[LastName] Like '*" &
> [ControlName] & "*'" Me.FilterOn = True """""
>
> But write the some code for hundreds filed become reaaly hard.
>
> It's possible change [LastName] with something similar that mean
> [EVERY FIELD]?
>

At the very least you will need to "fold" your table so all the text data is
in a single column, each row identified by the table's key. To do this, you
would use a union query:

select keyfield1,...,keyfieldN,"Testfield1_Name" As TextFieldName,
TextField1 As TextValue
FROM tablename
union
select keyfield1,...,keyfieldN,"Testfield2_Name", TextField2 FROM tablename
union
select keyfield1,...,keyfieldN,"Testfield3_Name", TextField3 FROM tablename
....
union
select keyfield1,...,keyfieldN,"TestfieldN_Name", TextFieldN FROM tablename

Save the query as "qTextUnion", for example. Then, to search for "MOKBA":
SELECT keyfield1,...,keyfieldN, TextFieldName, TextValue
FROM qTextUnion
WHERE TextValue LIKE "*MOKBA*"

The problem of course will be performance.


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Access 2010 - Form - Box "Search" in Navigation bar ancucchi@gmail.com Microsoft Access 0 30th Aug 2012 10:44 AM
RE: Access 2010 Forms - Converting 2007 Client into 2010 Web Maurice Microsoft Access Form Coding 0 26th Mar 2010 02:48 PM
Form 4 Range of time from 1/20/2010 4:00 AM To 1/21/2010 10:00 AM Peter Gonzalez Microsoft Excel Worksheet Functions 2 26th Jan 2010 07:58 PM
ie7 does not display menu bar, navigation bar, url bar, or prettymuch anything else (even tab bar) proteanthread Windows XP General 3 16th Jun 2007 11:48 PM
ie 7 does NOT display tabs or tab bar or navigation bar or even amenu bar proteanthread Windows XP New Users 1 15th Apr 2007 03:30 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:08 AM.