I'm writing a DB import function in VB6 with an Access 2000 DB.
I need to test images stored in the two DBs to see if they are the same.
They are stored using RhinoBull's method.
I tried the following code, but I get a 'Type mismatch' error.
Code:Private Function PictureMatch(ByRef OrgID As Long, ByRef ImprtID As Long) As Boolean Dim rsO As ADODB.Recordset Dim rsI As ADODB.Recordset Dim sSQL As String If OrgID = 0 Or ImprtID = 0 Then PictureMatch = OrgID = ImprtID Exit Function End If Set rsO = New ADODB.Recordset Set rsI = New ADODB.Recordset sSQL = "SELECT * FROM tblPics WHERE PicID = " & CStr(OrgID) rsO.Open sSQL, cn, adOpenStatic, adLockOptimistic, adCmdText If Not rsO.EOF Then sSQL = "SELECT * FROM tblPics WHERE PicID = " & CStr(ImprtID) rsI.Open sSQL, cn2, adOpenStatic, adLockOptimistic, adCmdText If Not rsI.EOF Then PictureMatch = rsI.Fields("Image") = rsO.Fields("Image") End If rsI.Close Set rsI = Nothing End If rsO.Close Set rsO = Nothing End Function




Reply With Quote