473,508 Members | 2,425 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 CurrentLoadListFrm and have it open another form called FreightProviderMatchFrm 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 4043
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 FreightProviderMatchFrm![ShipperCode1] = CurrentLoadListFrm![ShipperCode1], FreightProviderMatchFrm![ShipperCode2]=CurrentLoadListFrm![ShipperCode2], FreightProviderMatchFrm![ShipperCode3]=CurrentLoadListFrm![ShipperCode3], FreightProviderMatchFrm![ConsigneeCode1]=CurrentLoadListFrm![ConsigneeCode1], FreightProviderMatchFrm![ConsigneeCode2]=CurrentLoadListFrm![ConsigneeCode2], FreightProviderMatchFrm![ConsigneeCode3]=CurrentLoadListFrm![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 FreightProviderMatchFrm![ShipperCode1] = CurrentLoadListFrm![ShipperCode1], FreightProviderMatchFrm![ShipperCode2]=CurrentLoadListFrm![ShipperCode2], FreightProviderMatchFrm![ShipperCode3]=CurrentLoadListFrm![ShipperCode3], FreightProviderMatchFrm![ConsigneeCode1]=CurrentLoadListFrm![ConsigneeCode1], FreightProviderMatchFrm![ConsigneeCode2]=CurrentLoadListFrm![ConsigneeCode2], FreightProviderMatchFrm![ConsigneeCode3]=CurrentLoadListFrm![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 "FreightProviderMatchFrm", , , "ShipperCode1='" & Forms!CurrentLoadListFrm![ShipperCode1] & "'" And "ShipperCode2='" & Forms!CurrentLoadListFrm![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
2018
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...
3
18191
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...
3
5779
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...
4
8906
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...
1
5227
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...
6
27043
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...
7
6704
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:...
1
2113
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...
12
4105
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...
0
7224
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
7118
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
7379
jinu1996
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...
1
7038
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...
0
7493
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
4706
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...
0
3192
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...
0
3180
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
415
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...

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.