-
Dec 15th, 2005, 05:26 PM
#1
Thread Starter
Fanatic Member
[RESOLVED] Access 2003 VBA Me.Filter(makes me cry)
Here is the code for the list box on my fearch form:
VB Code:
Private Sub lstResult_Click()
Dim tmp As String
Dim x As Integer
For x = 0 To lstResult.ColumnCount - 1
tmp = tmp & lstResult.Column(x, 0) & "='" & lstResult.Column(x, lstResult.ListIndex + 1) & "', "
Next
tmp = Left(tmp, Len(tmp) - 3)
strFILTER = tmp
DoCmd.OpenForm "Permits-PermitInfo"
End Sub
Here is the code for my main form load:
VB Code:
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:
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?
-
Dec 16th, 2005, 06:48 AM
#2
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?
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...
-
Dec 16th, 2005, 09:42 AM
#3
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:
Private Sub lstResult_Click()
strFILTER = "[RecID] = " & lstResult.Column(0, lstResult.ListIndex + 1)
DoCmd.OpenForm "Permits-PermitInfo"
End Sub
then in the form load event of the permits form
VB Code:
Private Sub Form_Load()
Me.Filter = Form_frmSearch.strFILTER
Me.FilterOn = True
End Sub
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Dec 16th, 2005, 10:23 AM
#4
Thread Starter
Fanatic Member
Re: Access 2003 VBA Me.Filter(makes me cry)
-
Dec 16th, 2005, 03:24 PM
#5
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|