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
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.
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]
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: -
DoCmd.OpenForm "FreightFroviderMatchFrm", , , "ShipperCode1 = Forms!CurrentLoadListFrm![ShipperCode1] AND ShipperCode2 = Forms!CurrentLoadListFrm![ShipperCode2] AND ...."
-
This assumes your fields are numbers, if not then the syntax will be different.
ShipperCode is not a number it is a code like this: "ABC-ABC-" How would the syntax change for this type of code.
Rabbit 12,516
Recognized Expert Moderator MVP - "ShipperCode1 = '" & Forms!CurrentLoadListFrm![ShipperCode1] & "'"
Any idea why I am getting a Type Mismatch error after entering the code above?
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.
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.
Sign in to post your reply or Sign up for a free account.
Similar topics |
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...
|
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...
|
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...
|
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...
|
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...
| |
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...
|
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:...
|
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...
|
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...
|
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,...
|
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...
| |
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: 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...
|
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...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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...
| |