I am facing the problem in select the item dates. This is because i only want the condition of month from table dates. So i think the data set i write it get the error. Any one can help me,Thanks.
con.Open()
sql = "SELECT DISTINCT Month(dates) FROM summary WHERE plants = '" & yieldsummary.cbPlant.Text & "' AND Year(dates) = " & cbYear.Text & ";"
da = New OleDb.OleDbDataAdapter(sql, con)
da.Fill(ds, "summary")
con.Close()
maxrow = ds.Tables("summary").Rows.Count
For a = 0 To maxrow - 1
sql2 = "SELECT * FROM summary WHERE Year(dates) = " & cbYear.Text & " AND plants = '" & yieldsummary.cbPlant.Text & "' AND line = '" & cbLine.Text & "'AND [B]Month(dates) = '" & ds.Tables("summary").Rows(a).Item("dates") & "'[/B]"
Next a