Hi All,
Need your help... Im trying to filter my data based on SQLString but is not done well... catch all data... below is the code
Private Sub Show_Filter()
Dim SQLString As String
Dim Date1 As String
Dim Date2 As String
Date1 = DateFrom.Date & " 12:00:00 AM"
Date2 = DateTo.Date & " 11:59:59 PM"
TableName = "CAcpm"
SQLString = "SELECT CAcpm.[No], CAcpm.Time, CAcpm.Date, CAcpm.[Pre CA], CAcpm.[Pos CA], CAcpm.[CA volume], CAcpm.Result, CAcpm.SKU, CAcpm.Remark, CAcpm.UserRec, CAcpm.[Vision Status], CAcpm.Station, CAcpm.UserIssue FROM " & TableName & " WHERE DateIn BETWEEN #" & Date1 & "# AND #" & Date2 & "#"
ds.Clear()
rs.CursorLocation = ADODB.CursorLocationEnum.adUseClient
rs.Open(SQLString, conn, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockOptimistic)
da.Fill(ds, rs, TableName)
DataGridView1.DataSource = ds.Tables(0)
End Sub