i'm trying to sort datagrid by branch name.
HTML Code:Private Sub dcmbSortBranch_Click(Area As Integer) Dim BranchSearh As String BranchSearch = UCase(dcmbSortBranch.Text) If BranchSearch = "" Then Adodc1.RecordSource = "SELECT e.end_of_day_report_id, e.report_date, b.branch_name, e.total_sales, e.total_expenses, e.details_expenses, e.total_unsold, e.remarks FROM end_of_day_reports e, branch_tbl b WHERE e.branch_id=b.branch_id" Else Adodc1.Recordset.MoveFirst Do While Adodc1.Recordset.EOF = False If BranchSearch = Adodc1.Recordset.Fields("branch_name") Then Adodc1.RecordSource = "SELECT e.end_of_day_report_id, e.report_date, b.branch_name, e.total_sales, e.total_expenses, e.details_expenses, e.total_unsold, e.remarks FROM end_of_day_reports e, branch_tbl b WHERE e.branch_id=b.branch_id AND b.branch_name =' & BranchSearch & '" End If Adodc1.Recordset.MoveNext Loop End If End Sub




Reply With Quote