Results 1 to 5 of 5

Thread: [RESOLVED] Access 2003 VBA Me.Filter(makes me cry)

  1. #1

    Thread Starter
    Fanatic Member cid's Avatar
    Join Date
    Nov 2002
    Location
    Fort Worth, Texas
    Posts
    854

    Resolved [RESOLVED] Access 2003 VBA Me.Filter(makes me cry)

    Here is the code for the list box on my fearch form:
    VB Code:
    1. Private Sub lstResult_Click()
    2.     Dim tmp As String
    3.     Dim x As Integer
    4.     For x = 0 To lstResult.ColumnCount - 1
    5.     tmp = tmp & lstResult.Column(x, 0) & "='" & lstResult.Column(x, lstResult.ListIndex + 1) & "', "
    6.     Next
    7.     tmp = Left(tmp, Len(tmp) - 3)
    8.     strFILTER = tmp
    9.     DoCmd.OpenForm "Permits-PermitInfo"
    10. End Sub

    Here is the code for my main form load:
    VB Code:
    1. Me.Filter = Form_frmSearch.strFILTER

    And my error:
    Run Time Error '2448'
    You cant assign a value to this object.

    And a sample of my filter, that came from my search form.
    VB Code:
    1. Tract_ID='201426', Permit_No='flemming', Line #='', Owners='Jason Flemming', Permit_Type='Seis.', Status='Good', Map_Layer='3C', Total_Miles='36', Agent='Nicholas Tallant', Summary='0', Scan='', Survey='29', Abstract='A-132', Section='7B', Township='', Range='', Meridian='', Lot_Parcel='1A', Plan_No='206531', County_Parish='Tarrant', State_Prov='Texas', Legal_Desc='', Tax_ID='452793998', Date_Signed='12/5/2005', Date_Expires='12/5/2006', Percent_Owned='', Tenants='0', Lessees='0', Price_to_Pay='0.5', Per='Mile', Total_to_Pay='18', Prepay='0', Paid='0', Date_Paid='', Paid_By_Agent='Nicholas Tallant', Check_No='22', Amount_Paid='22', Crop_Damages='ds2', Call_Before_Entry='-1', Call_Before='0', Dams_Ponds='0', Buildings='0', Livestock='0', Waterwells='0', WW_Count='', WW_Test_Before='0', WW_Test_After='0', Locked_Gates='0', Pipelines='0', Crops='0', Notify_Comp='0', Data_Req='0', Plat_Req='0', Conditions='sadfads', Owner_SSN_SIN='', Spouse_SSN_SIN='', Home_Address='425 Gold Finch St.', Home_Town_City='Fort Worth', Home_State_Prov='Texas', Home_Zip_Postal='76108', Mail_Address='', Mail_Town_City='', Mail_State_Prov='', Mail_Zip_Postal='', Phone_1='817-367-2872', Phone_1_Type='', Phone_2='817-723-9327', Phone_2_Type='', Phone_3='', Phone_3_Type='', Phone_4='', Phone_4_Type='', Notes='', Client='', Project='', Acre='60', DoOwn='', MinLeased='', Whom='

    I believe the erorr lies in the formatting of these fields...

    I dont know though, anyone have any ideas?

    www.google.com - Pay Tribute.

    Always Listening To: Thrice

  2. #2
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Re: Access 2003 VBA Me.Filter(makes me cry)

    numbers don't need single quotes?

    hmm maybe it doesn't like the variable being public on the form?

    Since this is access, on the docmd.openform there is an arguments option (last setting) the rest are optional, so you can blank them.

    If you pass the filter into the openarrgs the opening form mcan read it as me.openargs

    Not sure if that helps.


    Also use ?
    Code:
    Me.Filter = forms("frmSearch").strFILTER
    But I think that it is because the variable needto be public and of course it cannot be on a form (the form module complains sometimes!).

    You could create a public variable in a normal module and reference that instead?

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  3. #3
    eltiT resU motsuC Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: Access 2003 VBA Me.Filter(makes me cry)

    ok..
    add the field "RecID" to your table
    set it to AutoNum and mark it Key

    VB Code:
    1. Private Sub lstResult_Click()
    2.     strFILTER = "[RecID] = " & lstResult.Column(0, lstResult.ListIndex + 1)
    3.     DoCmd.OpenForm "Permits-PermitInfo"
    4. End Sub
    then in the form load event of the permits form
    VB Code:
    1. Private Sub Form_Load()
    2. Me.Filter = Form_frmSearch.strFILTER
    3. Me.FilterOn = True
    4. End Sub
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  4. #4

    Thread Starter
    Fanatic Member cid's Avatar
    Join Date
    Nov 2002
    Location
    Fort Worth, Texas
    Posts
    854

    Re: Access 2003 VBA Me.Filter(makes me cry)

    ty, resolved.

    www.google.com - Pay Tribute.

    Always Listening To: Thrice

  5. #5
    eltiT resU motsuC Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: [RESOLVED] Access 2003 VBA Me.Filter(makes me cry)

    always happy to save your *** lol
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width