473,666 Members | 2,208 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Multiple Field Filtering

17 New Member
I want to be able to double click on a field called Weight on CurrentLoadList Frm and have it open another form called FreightProvider MatchFrm and filter on six different fields that are on both of the forms listed above. The six fields are: ShipperCode1, ShipperCode2, ShipperCode3, ConsigneeCode1, ConsigneeCode2, and ConsigneeCode3. The net result will hopefully give me a list of Carriers that have done the exact same loads in the past that I am looking for a truck for the future. Any Ideas? Access 2003
Jul 16 '07 #1
8 4053
Rabbit
12,516 Recognized Expert Moderator MVP
The DoCmd.OpenForm( )'s 4th parameter is a SQL Where string that can be used to filter the form's records when it opens.
Jul 16 '07 #2
jjstevens
17 New Member
Here is the Where Statement I came up with, Can someone tell me why this doesn't work! I am a novice at this whole thing.

Where FreightProvider MatchFrm![ShipperCode1] = CurrentLoadList Frm![ShipperCode1], FreightProvider MatchFrm![ShipperCode2]=CurrentLoadLis tFrm![ShipperCode2], FreightProvider MatchFrm![ShipperCode3]=CurrentLoadLis tFrm![ShipperCode3], FreightProvider MatchFrm![ConsigneeCode1]=CurrentLoadLis tFrm![ConsigneeCode1], FreightProvider MatchFrm![ConsigneeCode2]=CurrentLoadLis tFrm![ConsigneeCode2], FreightProvider MatchFrm![ConsigneeCode3]=CurrentLoadLis tFrm![ConsigneeCode3]
Jul 17 '07 #3
Rabbit
12,516 Recognized Expert Moderator MVP
Here is the Where Statement I came up with, Can someone tell me why this doesn't work! I am a novice at this whole thing.

Where FreightProvider MatchFrm![ShipperCode1] = CurrentLoadList Frm![ShipperCode1], FreightProvider MatchFrm![ShipperCode2]=CurrentLoadLis tFrm![ShipperCode2], FreightProvider MatchFrm![ShipperCode3]=CurrentLoadLis tFrm![ShipperCode3], FreightProvider MatchFrm![ConsigneeCode1]=CurrentLoadLis tFrm![ConsigneeCode1], FreightProvider MatchFrm![ConsigneeCode2]=CurrentLoadLis tFrm![ConsigneeCode2], FreightProvider MatchFrm![ConsigneeCode3]=CurrentLoadLis tFrm![ConsigneeCode3]
The correct syntax would be:
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenForm "FreightFroviderMatchFrm", , , "ShipperCode1 = Forms!CurrentLoadListFrm![ShipperCode1] AND ShipperCode2 = Forms!CurrentLoadListFrm![ShipperCode2] AND ...."
  2.  
This assumes your fields are numbers, if not then the syntax will be different.
Jul 17 '07 #4
jjstevens
17 New Member
ShipperCode is not a number it is a code like this: "ABC-ABC-" How would the syntax change for this type of code.
Jul 17 '07 #5
Rabbit
12,516 Recognized Expert Moderator MVP
Expand|Select|Wrap|Line Numbers
  1. "ShipperCode1 = '" & Forms!CurrentLoadListFrm![ShipperCode1] & "'"
Jul 17 '07 #6
jjstevens
17 New Member
Any idea why I am getting a Type Mismatch error after entering the code above?
Jul 18 '07 #7
jjstevens
17 New Member
VB Code:

DoCmd.OpenForm "FreightProvide rMatchFrm", , , "ShipperCode1=' " & Forms!CurrentLo adListFrm![ShipperCode1] & "'" And "ShipperCode2=' " & Forms!CurrentLo adListFrm![ShipperCode2] & "'"

This code works if you only include the first ShipperCode1 and leave off the second ShipperCode2. Any ideas as to how to add more than one variable.
Jul 18 '07 #8
Rabbit
12,516 Recognized Expert Moderator MVP
The And logical comparison operator has to be within the the quotes.

"Expr1 AND Expr2"

Not "Expr1" AND "Expr2"

The former is a string to be evaluated. It will evaluate whether or not expression 1 and 2 are both true.

The latter attempts to evalute the whether or not the 2 strings are true.
Jul 18 '07 #9

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

Similar topics

1
2031
by: mike | last post by:
Hello all, any advice or links to pages about how to have multiple language asp pages? For example, you have a database driven website that you want customers around the world to use. How do you setup the asp pages so that it is easy to change the text based on where the user is connecting from? Thanks, Mike
3
18220
by: arthur-e | last post by:
I can filter a query for a report on a field of a subform BUT now.... I'd like to be able to select more than one item in a multi-list box to select all the records. ALSO to use two fields (or more) fields to filter a query based on selections in two or more fields: All the records with NAME = all the names selected in a list box BETWEEN StartDate and EndDate
3
5783
by: Wim Verhavert | last post by:
Hi all, I'm bothered with this question for weeks now.... Is it possible to edit multiple records at once using VBA? I have this continuous form and depending on the selection the user makes, I want to edit another table (not the recordsource of the form) in my database. How can I access the selected records in VBA? Any ideas would be very welcome.... Thanks in advance,
4
8932
by: Doug | last post by:
I have your typically form/subform. You enter the account number in a textbox and select whether you want to see the detail or summary information on the main form. Both fields I want to filter on are text. Here is a sample of the code I am using. The filtering works fine when I do them independently (see below) Forms!..Form.Filter = " =" & Me! Forms!..Form.Filter =
1
5242
by: mstery | last post by:
I have a report generated via an ID selection made in a dropdown on a form. The report filters by an on click event in a preview report button on the form. Everything in the report, including subreports, filters perfectly, with the exception of a running sum DLookup field on the main report. This field looks up a value in a foreign table. I'm not clear where I'm supposed to be filtering this field, since it obviously isn't picking up the...
6
27062
by: kcddoorman | last post by:
I built a select query filled with fields from multiple tables and queries. I have one field in this particluar query that will filter out a single order number. In the criteria box I put and that does the trick for filtering for one single record. What would the criteria syntax be if I wanted to filter for multiple order numbers? I'm thinking I will need as many as ten orders filtered for so I can create a report on them. I've read about this...
7
6732
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: http://allenbrowne.com/ser-28.html) since it has worked so well in the past. However, now I'm trying to filter by date instead of by a string or a number, and I'm getting nowhere. My goal is to have users type a date into the unbound combo box and...
1
2119
by: clickncook | last post by:
I'm currently working on a website for recipes that allows users to search by ingredients they have and I'm experiencing a problem with my filtering. My site allows users to just check the checkboxes of ingredients they have. I've been in and out of every forum I can find on the internet any solution and this forum has been pretty helpful! I'm using PostNuke for my CMS & the bulk of my program is run through Pagesetter. I can get my simple...
12
4129
daniel aristidou
by: daniel aristidou | last post by:
hi i was wondering if it is possible to filter multiple numbers of tables at the same time. the filter would be automatically applied ie. as in a query. However i want only one list to appear when it is run.therefore not a exactly a multiple filter but a filter on one table where all the data is temporarily put when the filter is run. this filter would auto matically run whenever the databased is open presumably by using and autoexecute...
1
8550
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8639
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7385
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5663
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4198
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4366
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2769
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1772
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.