1418b Re: Search Form and Checkboxes...
Sign Up |  Live StatsLive Stats    Articles 37,351| Comments 177,417| Members 19,424, Newest yashpal singh| Online 374
Home Contact
 (Forgotten?): 
    Sikhism
    For best SPN experience, use Firefox Internet Browser!


                                                                   Your Banner Here!    




Click Here to Register/Sign Up Daily Hukamnama Member Blogs Downloads Website Navigation Help Fonts Tags

Re: Search Form and Checkboxes...

Our Donation Goal : Why Donate? : Donate Today! : Donate Anonymously (ਗੁਪਤ) : Our Family of Supporters
Goal this month: 500 USD, Received: 115 USD (23%)
Please Donate...
     
Related Topics...
Thread Thread Starter Forum Replies Last Post
Search separate terms in a form Archie Information Technology 2 28-Jul-2006 08:38 AM
Creating a search form with checkboxes laurapizzolo@gmail.com Information Technology 1 28-Jul-2006 08:33 AM
Form search michael_parry2005@hotmail.co.uk Information Technology 2 28-Jul-2006 08:29 AM
CheckBoxes on a Form Secret Squirrel Information Technology 6 03-Nov-2005 11:35 AM
search form antonov Information Technology 0 28-Oct-2005 18:00 PM


Tags
search, form, checkboxes
Reply Post New Topic In This Forum Stay Connected to Sikhism, Click Here to Register Now!
  #1 (permalink)  
Old 28-Jul-2006, 08:00 AM
[MVP] S.Clark's Avatar [MVP] S.Clark
Guest
 
Posts: n/a
   
   
Re: Search Form and Checkboxes...

  Donate Today!   Email to Friend  Tell a Friend   Show Printable Version  Print   Contact sikhphilosophy.net Administraion for any Suggestions, Ideas, Feedback.  Feedback  

Register to Remove Advertisements
Try:

If ckbInvestigated Then
strWhere = strWhere & " AND " & "tblDiscrepancies.[INVESTIGATED?]"
End If


--
Steve Clark, Access MVP
FMS, Inc
http://www.fmsinc.com/consulting
Professional Access Database Repair
*FREE* Access Tips: http://www.fmsinc.com/free/tips.html


"chelsea" wrote in message
news:06E29700-58D7-4661-B74D-333BBF9BAF7C@microsoft.com...
> I'm trying to adapt a form from one of the Microsoft Templates (Issues
> Database). There is an unbound form with various text boxes, which
> filters a
> subform when the "search" command button is pressed. I've added several
> text boxes to the form to correspond with fields in my table, and they
> work
> fine. For example, the code for the Location text box in the On_Click
> command of the Search
> button is
>
> ' If Location
> If Nz(Me.txtbLocation) <> "" Then
> ' Add it to the predicate - match on leading characters
> strWhere = strWhere & " AND " & "tblDiscrepancies.LOCATION Like '*"
> & Me.txtbLocation & "*'"
> End If
>
> This works fine, and all the other text boxes seem to work fine as well.
> The problem i've run into, however, is that 3 fields in my table are
> Yes/No. I've added check boxes to the form for these fields, but i'm not
> entirely sure about the code i should use. If the user selects the check
> box, I want the search to return only those records for which the field =
> Yes. If the user does not select the check box, I want the seach to
> return
> ALL records, both Yes and No.
>
> Right now, I have
>
> ' If Investigated
> If Nz(ckbInvestigated, 0) = Yes Then
> strWhere = strWhere & " AND " & "tblDiscrepancies.INVESTIGATED? =
> Yes"
> End If
>
> for each checkbox. But when I try to run it, i get the error
>
> Runtime Error: 2448
> You can't assign a value to this object.
>
> When I debug, " Me.sbfrmDiscrepancies.Form.Filter = strWhere" is
> highlighted
> in the code.
>
> I've included the full code below:
>
> Private Sub Search_Click()
> strWhere = "1=1"
>
> ' If Survey Date From
> If IsDate(Me.txtbSurveyDateFrom) Then
> ' Add it to the predicate - exact
> strWhere = strWhere & " AND " & "tblDiscrepancies.[DATE] >= " &
> GetDateFilter(Me.txtbSurveyDateFrom)
> ElseIf Nz(Me.txtbSurveyDateFrom) <> "" Then
> strError = cInvalidDateError
> End If
>
> ' If Survey Date To
> If IsDate(Me.txtbSurveyDateTo) Then
> ' Add it to the predicate - exact
> strWhere = strWhere & " AND " & "tblDiscrepancies.[DATE] <= " &
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/information-technology/9191-re-search-form-and-checkboxes.html
> GetDateFilter(Me.txtbSurveyDateTo)
> ElseIf Nz(Me.txtbSurveyDateTo) <> "" Then
> strError = cInvalidDateError
> End If
>
> ' If Resolved Date From
> If IsDate(Me.txtbResolvedDateFrom) Then
> ' Add it to the predicate - exact
> strWhere = strWhere & " AND " & "tblDiscrepancies.[DATE RESOLVED]
> >=

> " & GetDateFilter(Me.txtbResolvedDateFrom)
> ElseIf Nz(Me.txtbResolvedDateFrom) <> "" Then
> strError = cInvalidDateError
> End If
>
> ' If Resolved Date To
> If IsDate(Me.txtbResolvedDateTo) Then
> ' Add it to the predicate - exact
> strWhere = strWhere & " AND " & "tblDiscrepancies.[DATE RESOLVED]
> <=
> " & GetDateFilter(Me.txtbResolvedDateTo)
> ElseIf Nz(Me.txtbResolvedDateTo) <> "" Then
> strError = cInvalidDateError
> End If
>
> ' If Equipment
> If Nz(Me.txtbEquipment) <> "" Then
> ' Add it to the predicate - match on leading characters
> strWhere = strWhere & " AND " & "tblDiscrepancies.EQUIPMENT Like
> '*"
> & Me.txtbEquipment & "*'"
> End If
>
> ' If Building
> If Nz(Me.txtbBuilding) <> "" Then
> ' Add it to the predicate - match on leading characters
> strWhere = strWhere & " AND " & "tblDiscrepancies.BUILDING Like '*"
> & Me.txtbBuilding & "*'"
> End If
>
> ' If Floor
> If Nz(Me.txtbFloor) <> "" Then
> ' Add it to the predicate - match on leading characters
> strWhere = strWhere & " AND " & "tblDiscrepancies.FL Like '*" &
> Me.txtbFloor & "*'"
> End If
>
> ' If Location
> If Nz(Me.txtbLocation) <> "" Then
> ' Add it to the predicate - match on leading characters
> strWhere = strWhere & " AND " & "tblDiscrepancies.LOCATION Like '*"
> & Me.txtbLocation & "*'"
> End If
>
> ' If IR Survey No
> If Nz(Me.txtbIRSurveyNo) <> "" Then
> ' Add it to the predicate - match on leading characters
> strWhere = strWhere & " AND " & "tblDiscrepancies.IR_SURVEY_NO Like
> '*" & Me.txtbIRSurveyNo & "*'"
> End If
>
> ' If Item No
> If Nz(Me.txtbItemNo) <> "" Then
> ' Add it to the predicate - match on leading characters
> strWhere = strWhere & " AND " & "tblDiscrepancies.ITEM_No Like '*"
> &
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=9191
> Me.txtbItemNo & "*'"
> End If
>
> ' If Investigated
> If Nz(ckbInvestigated, 0) = True Then
> strWhere = strWhere & " AND " & "tblDiscrepancies.INVESTIGATED? =
> True"
> End If
>
>
>
> If strError <> "" Then
> MsgBox strError
> Else
> 'DoCmd.OpenForm "sbfrmDiscrepancies", acFormDS, , strWhere,
> acFormEdit, acWindowNormal
> If Not Me.FormFooter.Visible Then
> Me.FormFooter.Visible = True
> DoCmd.MoveSize Height:=Me.WindowHeight + Me.FormFooter.Height
> End If
> Me.sbfrmDiscrepancies.Form.Filter = strWhere
> Me.sbfrmDiscrepancies.Form.FilterOn = True
> End If
> End Sub
>
>
> Any help would be appreciated!
>







Got anything to share on This Topic? Why not share your immediate thoughts/reaction with us! Login Now! or Sign Up Today! to share your views... Gurfateh!
Reply With Quote
Sponsored Links
   Click Here to Donate Now!

Support Us!
Become a Promoter!
Gurfateh ji, you can become a SPN Promoter by Donating as little as $10 each month. With limited resources & high operational costs, your donations make it possible for us to deliver a quality website and spread the teachings of the Sri Guru Granth Sahib Ji, to serve & uplift humanity. Every contribution counts. Donate Generously. Gurfateh!
ReplyPost New Topic In This Forum Stay Connected to Sikhism, Click Here to Register Now!

Bookmarks


(View-All Members who have read this thread : 0
There are no names to display.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Tools Search
Search:

Advanced Search
Display Modes

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 On
Trackbacks are On
Pingbacks are On
Refbacks are On

» Active Discussions
Is Science a Religion?
Today 07:47 AM
18 Replies, 2,093 Views
UNITED SIKHS AID Team...
Today 03:19 AM
0 Replies, 41 Views
Woolwich Killing: The...
Today 03:05 AM
26 Replies, 301 Views
Abu Nusaybah, 'Friend'...
Today 02:33 AM
0 Replies, 53 Views
Stockholm riots throw...
Today 02:14 AM
10 Replies, 123 Views
How does Sikhi help you...
Today 02:04 AM
48 Replies, 1,232 Views
Sikh Spokesman (ਪੰਜਾਬੀ...
Today 01:52 AM
186 Replies, 4,675 Views
Rozana Reports (ਪੰਜਾਬੀ...
Today 01:41 AM
322 Replies, 7,747 Views
Paneer: what I have...
Yesterday 22:29 PM
8 Replies, 89 Views
How Many Sikhs Have...
Yesterday 21:55 PM
698 Replies, 51,746 Views
Transgenderism ... Right...
By Kaylee
Yesterday 17:55 PM
31 Replies, 1,385 Views
Rochester Gurdwara...
Yesterday 10:55 AM
2 Replies, 89 Views
US Congress panel passes...
Yesterday 04:22 AM
0 Replies, 55 Views
Harmeet Kaur Took the...
Yesterday 03:40 AM
0 Replies, 75 Views
Panjabi Alphabet Resource
24-May-2013 23:15 PM
12 Replies, 6,566 Views
» Books You Should Read...
Powered by vBadvanced CMPS v3.2.3
All times are GMT +6.5. The time now is 11:10 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2 Copyright © 2004-12, All Rights Reserved. Sikh Philosophy Network


Page generated in 0.82942 seconds with 32 queries
0