473,387 Members | 1,597 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,387 software developers and data experts.

Filter records with Right string

Hey everyone,

New here and fairly new to Access programming. I'm using Access 2003 in XP SP2 I've used this site before without having to ask a question but I'm really stuck :(

I have a table that I need to filter with the "on click" of a form button. The table has a column called "partnum" (part number). The part numbers are divided with a dash, and then part catagories are broken down with a number range, i.e. all "1000" parts are incoming, all "2000" parts are winding...etc. The part number format is:

XXXXXX-1XXX (for incoming)
XXXXXX-2XXX (for winding)...etc

I need to filter out all "1000" part types. I understand the concept of using me.filter and then having a string that takes the right 4 numbers and showing only the parts greater than "1999", but I have no idea what the syntax would be other than starting with "me.filter" and then after the string having "me.filter = true" (I think).

Then, I need a button that would show only parts within a certain range. As in showing all "3000" parts...etc

*sigh* I told them I new very little about VBA...hehe...but I guess I'm learning as I go...trial by fire!

Any help would be greatly appreciated :)

Thanks

emo10001
Oct 4 '07 #1
2 1895
Well I finally got it. So if anyone runs into a similar situation, heres the code found to work:

Me.Filter = "right([partno],4)>1999"
Me.FilterOn = True

(oh, and I figured out that it was partno, not partnum)

Also for the n00bs like me. Always remember that you can do most things in the form properties. How I really figured this out was putting my cursor in the "filter" of the partno properties box and hitting F1 for more info.
Oct 4 '07 #2
mlcampeau
296 Expert 100+
Well I finally got it. So if anyone runs into a similar situation, heres the code found to work:

Me.Filter = "right([partno],4)>1999"
Me.FilterOn = True

(oh, and I figured out that it was partno, not partnum)

Also for the n00bs like me. Always remember that you can do most things in the form properties. How I really figured this out was putting my cursor in the "filter" of the partno properties box and hitting F1 for more info.
Glad you got it figured out. Thanks for posting your solution!
Oct 4 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: dick | last post by:
I am just trying to print/report the results of a "filter by selection" which is done by right-clicking a form, filling in values, and "applying the filter." I have searched the newsgroups, and...
2
by: Salad | last post by:
I have a log file with a list of records. The log file can be unfiltered or filtered. I have a command button to call a data entry form from the log. At first I was only going to present the...
3
by: dhowell | last post by:
In reading some of the posts on this group, it appears as though it is not strait forward at all to filter a form, which has subforms, by criteria which are either on subforms or span more than one...
5
by: Ron S | last post by:
After days of searching I finally an example that would work with my application, the only problem is after entering all of the code it is not working. Would someone be kind enough to take a look at...
3
by: emgallagher | last post by:
I have a form which lists studies. People can filter the form based on details about the study, such as the study type. Currently users filter via the right click method. I would like to be...
7
by: Katherine | last post by:
I'm trying to filter the records on the mainform (MailingList) of my database using a field contained in a subform (Donations). I was basing my code off Allen Browne's Access Tips page (here:...
6
by: jmarcrum | last post by:
Hi! I have created a Union Query in ACCESS 2003, that combines 130 records from one query (Extra Foreman Radios) and 250 records from another query (Forman Main Radios). I have created a...
2
by: lhsiber | last post by:
I am new to access and am having a problem with filtering. Here is a little bit of my setup: I have a main form that has a listbox so that users can choose one or many groups in which to display...
1
by: woodey2002 | last post by:
Hi Everyone and many thanks for your time.. I am trying to begin access and a bit of VBA i am enjoying it but I have a annoying problem I just can’t get any where on. My databse mostly includes...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
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...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...

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.