How do I have a listbox in a form update a query

G

guidop12

I hope I can explain this correctly. Here goes.
I have a query that the SQL code is as follows

INSERT INTO CompanyOneYr ( Company, [Total Revenue] )
SELECT TOP 50 [dbo_tblCustomers].[Company], Sum(nz([RevenueTotal],0)) AS
[Total Revenue]
FROM (dbo_tblCustomers INNER JOIN dbo_tblOrders ON
[dbo_tblCustomers].[CustomerID]=[dbo_tblOrders].[CustomerID]) INNER JOIN
qryRevenueDetailTotals ON
[dbo_tblOrders].[OrderID]=[qryRevenueDetailTotals].[OrderID]
WHERE ((([dbo_tblOrders].[CloseDate]) Between [Forms]![Dates]![Date1] And
[Forms]![Dates]![Date2] And ([dbo_tblOrders].[CloseDate]) Between
[Forms]![Dates]![Date1] And [Forms]![Dates]![Date2] And
([dbo_tblOrders].[CloseDate]) Between [Forms]![Dates]![Date1] And
[Forms]![Dates]![Date2] And ([dbo_tblOrders].[CloseDate]) Between
[Forms]![Dates]![Date1] And [Forms]![Dates]![Date2]))
GROUP BY [dbo_tblCustomers].[Company]
ORDER BY Sum(nz([RevenueTotal],0)) DESC;

What I want to do is after the query gets updated once, to then have a form
come up that has the company name and then a list box that has either A, R,
P, C in it. When the user selects one of the choices for each company I would
like to have the query updated with a new column called category with what
the user selects.

Please feel free to ask further questions if needed. And again thank you for
all your help, I'm learning a lot from these forums.
 
G

guidop12

guidop12 said:
I hope I can explain this correctly. Here goes.
I have a query that the SQL code is as follows
SELECT [qryUpdateCompanyOneTable w/sequence].Sequence, [qryUpdateCompanyOneTable w/sequence].Company, [qryUpdateCompanyOneTable w/sequence].[Total Revenue], "Category" AS Expr1, [qryUpdateCompanyTwoTable w/sequence].Sequence, [qryUpdateCompanyTwoTable w/sequence].Company, [qryUpdateCompanyTwoTable w/sequence].[Total Revenue]
FROM [qryUpdateCompanyOneTable w/sequence] LEFT JOIN
[qryUpdateCompanyTwoTable w/sequence] ON [qryUpdateCompanyOneTable
w/sequence].Company = [qryUpdateCompanyTwoTable w/sequence].Company;
 
G

guidop12

I'm sorry the SQl code is as follows not from the original message
SELECT [qryUpdateCompanyOneTable w/sequence].Sequence,
[qryUpdateCompanyOneTable w/sequence].Company, [qryUpdateCompanyOneTable
w/sequence].[Total Revenue], "Category" AS Expr1, [qryUpdateCompanyTwoTable
w/sequence].Sequence, [qryUpdateCompanyTwoTable w/sequence].Company,
[qryUpdateCompanyTwoTable w/sequence].[Total Revenue]
FROM [qryUpdateCompanyOneTable w/sequence] LEFT JOIN
[qryUpdateCompanyTwoTable w/sequence] ON [qryUpdateCompanyOneTable
w/sequence].Company = [qryUpdateCompanyTwoTable w/sequence].Company;

And it is the Category AS Expr1 field that is what I want updated
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top