Hello
I’m using VB 6 as a front end to Access 03 database to populate the MSChart control.
I have a combobox for defect categories. I would like to populate the chart with a single category selected from the combobox.
Not sure what to put in place of the * as shown in the statement below. I would like to display the date (Weeks) and the category with the number of defects.
Code:
Private Sub CategoryView()
' Display the category of chart data
Set cmd.ActiveConnection = cn
cmd.CommandText = "SELECT * FROM tbliface WHERE [Weeks] = '" & cboCategory.Text & "'" _
& " ORDER BY [Weeks]"
Yes, sorry for the confusion. The fields are...
Weeks Analyzer Humphrey Accumulator Pump Regulator Card NDF Solenoid.
This case definitely don't want all the fields returned. I guess I get lazy and use * when I want to cut down on the code.
Is this even in the ballpark?...
Code:
cmd.CommandText = "SELECT '" & cboCategory.Text & "' FROM tbliface WHERE [Weeks] = '" & cboCategory.Text & "'" _
& " ORDER BY [Weeks]"
I want to return only two fields keying on the selection from the cboCategory combobox. The date field and the category chosen. Currently this isn't returning anything.
These are in the drop down...
Analyzer Humphrey Accumulator Pump Regulator Card NDF Solenoid
When I set a breakpoint just after the cmd.CommandText statement and run this I cursor over '" & cboCategory.Text & "' and get the choice made from the combobox. But nothing shows in Weeks when cursored over.
And, just in case I will want to take a look at what you currently have, in addition to answering my last question, you might as well zip up what you currently have and attach it.
I may not need it, but, if I do, it will save time.
Remove your error trapping so that it will generate a runtime error, and tell me what that error is.
(BTW: Never add error handling until you are pretty sure there are no more errors. I know that sounds strange, but it is a general rule of thumb. While developing, you want errors to occur, in their natural habitate, so you can fix them. Once you have all of the errors, that you know about fixed, then add your error handling to deal with the errors you don't know about.)