Need to query three controls on a form

  • Thread starter Thread starter SAC
  • Start date Start date
S

SAC

I have a form with three drop down boxes. The data source for each is the
same.

Driver1

Driver2

Driver3

They all lookup from the Driver Table. So, potentially they cold all be the
same driver.

How do I write a query that will get all the orders for the same driver
wheather the driver shows up in Driver1, Driver2, or Driver3 control on the
form?

Thanks for your help.
 
SAC said:
I have a form with three drop down boxes. The data source for each is the
same.

Driver1

Driver2

Driver3

They all lookup from the Driver Table. So, potentially they cold all be
the same driver.

How do I write a query that will get all the orders for the same driver
wheather the driver shows up in Driver1, Driver2, or Driver3 control on
the form?

Thanks for your help.

SELECT * FROM tblOrders WHERE ([driver]='" & cboDriver1 & "') OR
([driver]='" & cboDriver2 & "') OR ([driver]='" & cboDriver3 & "')"

Carl Rapson
 
Perhaps the following. I am assuming that you have three fields in your
table named Driver1, Driver2, and Driver3.

SELECT *
FROM YourTable
WHERE Driver1 = [Driver?] or Driver2 = [Driver?] or Driver3 = [Driver?]

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 
Thanks!

How can I group this by driver so a report would sumarize the records by
driver?

Thanks again.


Carl Rapson said:
SAC said:
I have a form with three drop down boxes. The data source for each is the
same.

Driver1

Driver2

Driver3

They all lookup from the Driver Table. So, potentially they cold all be
the same driver.

How do I write a query that will get all the orders for the same driver
wheather the driver shows up in Driver1, Driver2, or Driver3 control on
the form?

Thanks for your help.

SELECT * FROM tblOrders WHERE ([driver]='" & cboDriver1 & "') OR
([driver]='" & cboDriver2 & "') OR ([driver]='" & cboDriver3 & "')"

Carl Rapson
 
Do that grouping in the report itself. Group by the [driver] field.

Carl Rapson

SAC said:
Thanks!

How can I group this by driver so a report would sumarize the records by
driver?

Thanks again.


Carl Rapson said:
SAC said:
I have a form with three drop down boxes. The data source for each is
the same.

Driver1

Driver2

Driver3

They all lookup from the Driver Table. So, potentially they cold all be
the same driver.

How do I write a query that will get all the orders for the same driver
wheather the driver shows up in Driver1, Driver2, or Driver3 control on
the form?

Thanks for your help.

SELECT * FROM tblOrders WHERE ([driver]='" & cboDriver1 & "') OR
([driver]='" & cboDriver2 & "') OR ([driver]='" & cboDriver3 & "')"

Carl Rapson
 
Thanks!

Carl Rapson said:
Do that grouping in the report itself. Group by the [driver] field.

Carl Rapson

SAC said:
Thanks!

How can I group this by driver so a report would sumarize the records by
driver?

Thanks again.


Carl Rapson said:
I have a form with three drop down boxes. The data source for each is
the same.

Driver1

Driver2

Driver3

They all lookup from the Driver Table. So, potentially they cold all be
the same driver.

How do I write a query that will get all the orders for the same driver
wheather the driver shows up in Driver1, Driver2, or Driver3 control on
the form?

Thanks for your help.



SELECT * FROM tblOrders WHERE ([driver]='" & cboDriver1 & "') OR
([driver]='" & cboDriver2 & "') OR ([driver]='" & cboDriver3 & "')"

Carl Rapson
 
Thanks! That'll do it!

John Spencer said:
Perhaps the following. I am assuming that you have three fields in your
table named Driver1, Driver2, and Driver3.

SELECT *
FROM YourTable
WHERE Driver1 = [Driver?] or Driver2 = [Driver?] or Driver3 = [Driver?]

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
.

SAC said:
I have a form with three drop down boxes. The data source for each is the
same.

Driver1

Driver2

Driver3

They all lookup from the Driver Table. So, potentially they cold all be
the same driver.

How do I write a query that will get all the orders for the same driver
wheather the driver shows up in Driver1, Driver2, or Driver3 control on
the form?

Thanks for your help.
 
Back
Top