
adErrInvalidArgument driving me nuts! please advise
Check this out
Private Function PrepareTheFilter() As Boolean
On Error GoTo vbError
PrepareTheFilter = False
Dim i As Integer
For i = 0 To cboOperator.Count - 1
If cboOperator(i).Text = "LIKE" Then
txtValue(i).Text = txtValue(i).Text & "*"
End If
Next i
For i = 0 To txtValue.Count - 1
If txtValue(i) <> "" Then
Dim enm As DataTypeEnum
enm = gFieldsDataType(cboFields(i).Text)
Select Case enm
Case adChar, adBSTR, adWChar
txtValue(i).Text = "'" & txtValue(i).Text & "*'"
Case adDate, adDBDate
txtValue(i).Text = "#" & txtValue(i).Text & "#"
Case adBigInt, adCurrency, adDecimal, adDouble, _
adInteger, adNumeric, adSingle, adTinyInt, _
adUnsignedBigInt, adUnsignedInt, adUnsignedSmallInt, _
adUnsignedTinyInt, adSmallInt, adBoolean
' do nothing, - stops access to Case Else below
Case Else
txtValue(i).Text = "'" & txtValue(i).Text & "'"
End Select
End If
Next i
For i = 0 To cboFields.Count - 1
' This sub/sub procedure places square brackets around
' a field name which contains a space between words
' eg Last Name becomes [Last Name]
Dim sNullStr As String
Dim sStr As String
Dim sNewStr
Dim n As Integer
' store the original value
sStr = cboFields(i).Text
' define the empty space to be found
sNullStr = " "
n = InStr(sStr, sNullStr)
If n > 0 Then
sNewStr = "[" & sStr & "]"
cboFields(i).Text = sNewStr
End If
Next i
PrepareTheFilter = True
Exit Function
vbError:
fs.Error
End Function
Quote:
> using mssql 6.5, vb6sp5
> I am trying to use adodc1.recordset.find to point to a
> specific record in a datagrid. the datagrid is populated
> with all records from a table. I have a seperate adodc2
> that uses a query to just get a specific record. I have
> bound 2 text boxes to the adodc2 records and am using
> these as criteria for my search. one field in the table is
> a varchar and one is a date/time. when i use find for the
> number "varchar colomn" it finds that record fine, but
> when i try to search by date I get error 3001. I havent
> got a type mismatch error unless i start converting stuff.
> heres my find:
> Adodc1.Recordset.Find "broadcast_date_time = " &
> Textnowtime.Text,1