Hi,
I've tried using this following code but I keep getting the following error:
Runtime Error 2448
You can't assign a value to this object.
Do you know what the problem may be? CHAPTER 5 - FORM MODULE - Option Compare Database
-
Option Explicit
-
-
Private Sub txtFindAccountCode_AfterUpdate()
-
Call CheckFilter
-
End Sub
-
-
Private Sub txtFindCreationDate_AfterUpdate()
-
Me!txtFindCreationDate = IIf(IsDate(Me!txtFindCreationDate), _
-
Format(Me!txtFindCreationDate, "d mmm yyyy"), _
-
"")
-
Call CheckFilter
-
End Sub
-
-
Private Sub cboFindAccountType_AfterUpdate()
-
Call CheckFilter
-
End Sub
-
-
'CheckFilter produces the new Filter depending on the values currently in
-
'txtFindAccountCode, txtFindCreationDate & cboFindAccountType.
-
Private Sub CheckFilter()
-
Dim strFilter As String, strOldFilter As String
-
-
strOldFilter = Me.Filter
-
'txtFindAccountCode - Text
-
If Me!txtFindAccountCode > "" Then _
-
strFilter = strFilter & _
-
" AND ([AccountCode] Like '" & _
-
Me!txtFindAccountCode & "*')"
-
'txtFindCreationDate - Date
-
If Me!txtFindCreationDate > "" Then _
-
strFilter = strFilter & _
-
" AND ([CreationDate]=" & _
-
Format(CDate(Me!txtFindCreationDate), _
-
"\#m/d/yyyy\#") & ")"
-
'cboFindAccountType - Numeric
-
If Me!cboFindAccountType > "" Then _
-
strFilter = strFilter & _
-
" AND ([AccountType]=" & _
-
Me!cboFindAccountType & ")"
-
'Debug.Print ".Filter = '" & strOldFilter & "' - ";
-
'Debug.Print "strFilter = '" & strFilter & " '"
-
'Tidy up results and apply IF NECESSARY
-
If strFilter > "" Then strFilter = Mid(strFilter, 6)
-
If strFilter <> strOldFilter Then
-
Me.Filter = strFilter
-
Me.FilterOn = (strFilter > "")
-
End If
-
End Sub
10 1619 NeoPa 32,556
Expert Mod 16PB
In the article itself ( Example Filtering on a Form) is not the place to start a discussion or a question so I've moved your post as a question to the Access Forum.
I will try to get to this sometime today to see if I can answer your question.
NeoPa 32,556
Expert Mod 16PB
Having now looked at your question it seems you want me to debug your code without even letting me know where your error occurred. The error message helps - but without the line of code it appears in it doesn't mean much
Please provide the information I need so that I can try to help you.
My apologies. The error occurs on Line 46
Me.Filter = strFilter
Having now looked at your question it seems you want me to debug your code without even letting me know where your error occurred. The error message helps - but without the line of code it appears in it doesn't mean much
Please provide the information I need so that I can try to help you.
NeoPa 32,556
Expert Mod 16PB
I was being Naive - I thought you'd posted your code.
I will need the code you're using as well as the line number the error occurrs on. We'll get there I'm sure - I just need the question.
*Edit - You're using the original code directly?
I was being Naive - I thought you'd posted your code.
I will need the code you're using as well as the line number the error occurrs on. We'll get there I'm sure - I just need the question.
Here's the code I used..... - Private Sub cboFindTL_AfterUpdate()
-
Call CheckFilter
-
End Sub
-
-
Private Sub cboFindSurname_AfterUpdate()
-
Call CheckFilter
-
End Sub
-
-
Private Sub CheckFilter()
-
Dim strFilter As String, strOldFilter As String
-
-
strOldFilter = Me.Filter
-
-
If Me!cboFindSurname > "" Then _
-
strFilter = strFilter & _
-
" AND ([Surname] Like '" & _
-
Me!cboFindSurname & "*')"
-
-
-
If Me!cboFindTL > "" Then _
-
strFilter = strFilter & _
-
" AND ([Team Leader]=" & _
-
Me!cboFindTL & ")"
-
-
If strFilter > "" Then strFilter = Mid(strFilter, 6)
-
If strFilter <> strOldFilter Then
-
Me.Filter = strFilter
-
Me.FilterOn = (strFilter > "")
-
End If
-
End Sub
NeoPa 32,556
Expert Mod 16PB
If you can confirm that the error occurred on line #27 then I can look at it in more detail.
I'm getting the error on line 27
Me.Filter = strFilter
Here's the code I used..... - Private Sub cboFindTL_AfterUpdate()
-
Call CheckFilter
-
End Sub
-
-
Private Sub cboFindSurname_AfterUpdate()
-
Call CheckFilter
-
End Sub
-
-
Private Sub CheckFilter()
-
Dim strFilter As String, strOldFilter As String
-
-
strOldFilter = Me.Filter
-
-
If Me!cboFindSurname > "" Then _
-
strFilter = strFilter & _
-
" AND ([Surname] Like '" & _
-
Me!cboFindSurname & "*')"
-
-
-
If Me!cboFindTL > "" Then _
-
strFilter = strFilter & _
-
" AND ([Team Leader]=" & _
-
Me!cboFindTL & ")"
-
-
If strFilter > "" Then strFilter = Mid(strFilter, 6)
-
If strFilter <> strOldFilter Then
-
Me.Filter = strFilter
-
Me.FilterOn = (strFilter > "")
-
End If
-
End Sub
Hi,
When debugging if I hoover over the variable strFilter on line 26 I can see that it has an actual valid string. But on line 27 it just doesn't seem to want to assign that string to the form.filter property. Does this help at all?
I'm getting the error on line 27
Me.Filter = strFilter
NeoPa 32,556
Expert Mod 16PB
What type of field is [Team Leader]?
Is Me!cboFindTL of the same type?
NeoPa 32,556
Expert Mod 16PB
Hi,
When debugging if I hoover over the variable strFilter on line 26 I can see that it has an actual valid string. But on line 27 it just doesn't seem to want to assign that string to the form.filter property. Does this help at all?
That does help and confirms my fear that this is not a code issue as much as a design issue. I can't imagine why this might happen I'm afraid.
Have you downloaded the example DB and seen if that works on your system?
PS. Ignore questions in earlier post as this info takes us past there.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Suzanne |
last post by:
Hello experts,
I am a VBA newbie. Most of the tricks I apply to my applications I learn
from here or google. I couldn't find a solution for the following two
things, they both are related to...
|
by: Jason |
last post by:
I am trying to filter records in a primary form based on records in
related tables. The data in the related tables is being displayed in
the primary form
through subforms. To be more specific, I...
|
by: Luther |
last post by:
I want to create a form that searches a table. The hard part is this,
I'd like to have the available records filtered based on combobox
selections. For example, if this were a vehicle database, I...
|
by: Patrick |
last post by:
I'm working on a contact management application, and need a hand with one
aspect...
Here's what I want to create:
------------------------------------
A form split into two parts. There is a...
|
by: Liddle Feesh |
last post by:
Hi,
I have a table named "Person" in a MSDE (2000) database, and am building a
search form comprising of search fields on the top section (forename,
surname, telephonenumber, etc) which all...
|
by: Mike Jakes |
last post by:
I hope that someone can offer a little advice on this one - I've
searched the group but can't find an answer. I think that I'm doing
something really stupid or missing something trivial, but see...
|
by: JUAN ERNESTO FLORES BELTRAN |
last post by:
Hi you all,
I am developping a python application which connects to a database
(postresql) and displays the query results on a treeview. In adittion to
displaying the info i do need to implement...
|
by: access baby |
last post by:
Hi
Below mention is the reply from Salad on my query i created a crosstab
query and form not based on any table of qurey but this doesnt work .
I somehow have missed something actually i have too...
|
by: plyable |
last post by:
Hi there. I made a program that reads data from a device through a serial port which then displays it in a textbox. As the data comes out in ASCII form, I have to filter out the unnecessary parts for...
|
by: oneski |
last post by:
help --- 403 You don't have permission
Im trying to get a basic search to work on my website, but i keep getting a forbidden error come up. Im using WAMP5 server on a vista machine. The error file...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |