Click to See Complete Forum and Search --> : Filtering


cyseng10
April 25th, 2001, 09:16 PM
i need help for filtering data. i using datagrid as displayed my data which using ADODC connect to the table. all is working OK and the data can be filtering by citeria like customerid. so, at the datagird, only the customerid which enter by user will be display. FYI, b4 doing any filtering. the datagrid sow all the data from table.

problem, i need to filtering from 2 tables and displayed out the result.

below is the code for a customerid and the filtering process(criteria control):-

Private Sub cmdFilter_Click()

Dim WhereClause As String
Dim Condition As String

WhereClause = ""
Condition = ""


If ((txtCustID.Text <> "") Or (cboDeviceType.Text <> "") Or (cboInDateTime.Text <> "") Or (cboOutDateTime.Text <> "") Or _
(cboServiceCode.Text <> "") Or (cboMsgStatus.Text <> "")) Then

WhereClause = "WHERE "

'based on txtCustID
If txtCustID.Text <> "" Then
Condition = "TRIM(CUSTOMERID) ='" & Trim(txtCustID.Text) & "' AND "
WhereClause = WhereClause + Condition
End If

*** call 1 table ***
SQLStr = "SELECT * FROM GWTRANSACTION " & WhereClause

AdodcGWTrans.RecordSource = SQLStr

AdodcGWTrans.Refresh
setAdminGatewayInfo

DataGrid1.Refresh
frmGWTransInfo.Refresh

End Sub

Regards,
Wilson Chai