473,398 Members | 2,343 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

DoCmd.Applyfilter

I cant get my filter to work with variables
Its working fine if I "hardcode" the issueType I want to filter on.

Works fine:
DoCmd.ApplyFilter , "issueType = 1"

Works NOT:
DoCmd.ApplyFilter , "issueType = currentType"

where currentType is a variable with the number of my type of issue.
A messagebox tell me that currentIssue really hold the right value...
Di I need to have any more symbols around a variable name?

Thankyou for any help!
(Im a new Access user and I really love Access!)

Robert

Nov 13 '05 #1
3 21638
Ro*********@yahoo.com wrote:
I cant get my filter to work with variables
Its working fine if I "hardcode" the issueType I want to filter on.

Works fine:
DoCmd.ApplyFilter , "issueType = 1"

Works NOT:
DoCmd.ApplyFilter , "issueType = currentType"
DoCmd.ApplyFilter , "issueType = " & currentType
should work.

where currentType is a variable with the number of my type of issue.
A messagebox tell me that currentIssue really hold the right value...
Di I need to have any more symbols around a variable name?

Thankyou for any help!
(Im a new Access user and I really love Access!)

Robert

Nov 13 '05 #2
Salad
It worked like a dream!
(I will NOT tell hove many ours I have spent on this...)
Thanks again!
Robert

Nov 13 '05 #3
Ro*********@yahoo.com wrote:
Salad
It worked like a dream!
(I will NOT tell hove many ours I have spent on this...)
Thanks again!
Robert

That's funny. It's happened to all of us where we get so involved that
we see the forest but not the trees.

One other thing. I've never used ApplyFilter. No reason why I haven't
except that I use another method that works fine too.

I may have a series of combo boxes that will create a filter. And I'll
call a routine to build the filter based on entries/selections made. Ex:
Dim strFilter As String
strFilter = "ActiveEmployee = " & Me.ComboActive
If Not IsNull(Me.City) Then
strFilter = strFilter & " And City = '" & Me.City & "'"
endif

Then I enter
Me.Filter = strFilter
Me.FilterOn = (strFilter > "")

So...I like setting Me.Filter and Me.FilterOn.
Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: jj | last post by:
I've got a form button that fires off 3 queries but if the first query returns an error, I don't want the other two queries to happen. Example: first query runs an insert from a linked table but...
1
by: Shaun | last post by:
Hi all Ok here is the big question, have a form that was bound to a now large database (Access 2002 client / server split) and I was accessing various records based on using applyfilter. Now to me...
15
by: Thelma Lubkin | last post by:
formA determines some_where and some_value and issues docmd.close ,Me docmd.openform "formB", , ,some_where, , ,some_value formB receives the correct some_where and some_value After...
2
by: Mike | last post by:
I am trying to open a search results form based on the input from a prompt form. I am using the following code: --- Begin Code --- Private Sub btnSearch_Click() 'Dim Variable and assign data...
1
by: Ryan | last post by:
Hello. I was hoping that someone may be able to assist with an issue that I am experiencing. I have created an Access DB which imports an Excel File with a particular layout and field naming. ...
3
by: Supermansteel | last post by:
I am trying to run a Apply filter for everytime someone opens Form_CC it will only show the Test (Test_ID) they are working on. This seems to be the closest I have gotten to filtering it correctly,...
1
by: natural | last post by:
Good Afternoon I have an option grou[ and on the after update i would like to provide the user with a msgbox, and then action placed my docmd.setwarnings false everywhere, but i still get my...
6
by: RZ15 | last post by:
Hi, I frequently have code in my forms that will turn warnings off, run make table queries, then turn warnings back on using the following code: DoCmd.SetWarnings WarningsOff DoCmd.OpenQuery...
4
by: gazza10001 | last post by:
Hi i hope you can help my company uses access and has modified for its needs usually what happens is you serach for the invoice by its number and then it brings all the information up such as...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
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...
1
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...
0
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.