Row source

Dachande11

Registered User.
Local time
Today, 17:43
Joined
May 1, 2001
Messages
41
I have a list box and I want to set the record source within VBA using SQL.
I have a query and its SQL code, what I would like to know is if the SQL code I have got can be used as I would like or if it cannot, what can I do to change this? Thanks to anyone who can help. The code is as follows;

SELECT [C/PTable].Description, Sum(ROVER1DT.[1999]) AS Qty
FROM ROVER1DT INNER JOIN [C/PTable] ON ROVER1DT.[C/P] = [C/PTable].Code
WHERE (((ROVER1DT.[Dealer Code])=[forms]![dealerparc]![dummy]) AND ((ROVER1DT.[Model Range]) Like [forms]![dealerparc]![model]))
GROUP BY [C/PTable].Description, ROVER1DT.[C/P]
ORDER BY ROVER1DT.[C/P];

Thanks

Mark
 
I am a bit unsure of what you are asking but I can tell you that you can change the Control Source of a List box using VB. If you have a query that you want to be the Control Source then code like: Me.ListBoxName.ControlSource = "QueryName" will do the trick. I would suggest that you use saved queries rather than SQL statements unless you need to build the SQL's as you go.
 

Users who are viewing this thread

Back
Top Bottom