Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / March 2007

Tip: Looking for answers? Try searching our database.

Searching

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Andrew C - 20 Mar 2007 02:25 GMT
Hi

Currently I have a form where staff members can search for clients.  It
shows Surname, First and Phone.  It also has the client ID and Active Status
of the client (but they are hidden)

My current code on exiting from searchbox is as follows:

Private Sub SearchBox_Exit(Cancel As Integer)
Me.List.RowSource = "SELECT [Clients Active].ClientID, [Clients
Active].Surname, [Clients Active].First, [Clients Active].Active,[Clients
Active].Phone FROM [Clients Active] WHERE ((([Clients Active].Surname) Like
'*" & Me.SearchBox & "*') AND (([Clients Active].Active)=yes)) ORDER BY
Client.Surname"
End Sub

What i want to add in the search form to include Acitve/Inactive Search
option.  So when staff is searching they can choose whether they wish to
seach the active or inactive clients.

I have added the options and they get vales of Active = 1, Inactive = 2.  
these values are not stored anywhere.  Unfortunatley the Clients table has
Active status listed as either Yes or No.  So i need it to relate active =
yes and inactive = no when it does its search

Is there anyway of being able to change my current code in incorporate this.

Not sure if i have explained it clear enough but if you have any questions
just ask.

Thanks

Andrew
niuginikiwi - 20 Mar 2007 05:10 GMT
Take a look at  Allen Browne's (Access MVP) search utility at
http://allenbrowne.com
Signature

niuginikiwi
Nelson, New Zealand

> Hi
>
[quoted text clipped - 29 lines]
>
> Andrew
John W. Vinson - 20 Mar 2007 05:12 GMT
>I have added the options and they get vales of Active = 1, Inactive = 2.  
>these values are not stored anywhere.  Unfortunatley the Clients table has
>Active status listed as either Yes or No.  So i need it to relate active =
>yes and inactive = no when it does its search

Use a criterion on the Active field of

[Forms]![yourformname]![optiongroupname] = 1

This expression will be True if they're looking for active clients, False if
they're looking for inactive ones.

This presumes that the status field is in fact a Yes/No field in your table
(which is actually stored as -1 for Yes, 0 for No, though the suggestion above
will work).

            John W. Vinson [MVP]
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.