-
Need MAJOR help !!!
Ok I have this dll where I am trying to establish a db connection in class module Connection. Then I create a RS with class module RS.
In the client App I use the following code. I am trying to pass the connection object between the 2 class modules in the dll. I get an error saying type mismatch where the red is. I AM ULTIMATELY TRYING TO TEST IF RS IS FILLED OR NOT.
Can anyone help me please?
Thanks
Code:
'THE CLIENT APP
Option Explicit
Private Sub Command1_Click()
Dim rs As GRSrch.rs
Set rs = New GRSrch.rs
Dim conn As GRSrch.Connection
Set conn = New GRSrch.Connection
Dim rsRecordset As ADODB.Recordset
conn.GetConn2
If rs.Get_Search_RS(conn, rsRecordset, Text1.Text, Text2.Text, Text3.Text, Text4.Text) = 1 Then
MsgBox "No record found"
Else
MsgBox "record found"
End If
conn.CloseConn
End Sub
Code:
'CONNECTION CLASS
Option Explicit
Public conn2 As ADODB.Connection
Public Sub GetConn2()
Set conn = New ADODB.Connection
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\Sms001\Shared\web\Internet\Graphic_Search\dbGraphics.mdb;Persist Security Info=False"
conn.CursorLocation = adUseClient
conn.Open
End Sub
'RS CLASS
Option Explicit
Public conn As ADODB.Connection
Public rs As ADODB.Recordset
Public sql As String
Public lngCount As Long
Public Function Get_Search_RS(conn As ADODB.Connection, rsRecordset As ADODB.Recordset, strTitle As String, strCat As String, strFileX As String, strFileName As String) As String
Set rs = New ADODB.Recordset
sql = "SELECT * FROM Master WHERE Master.Title LIKE '%" & strTitle & "%' and Master.Cat LIKE '%" & strCat & "%' and Master.FileExtension LIKE '%" & strFileX & "%' and Master.FileName LIKE '%" & strFileName & "%' ORDER BY FileName"
rs.Open sql, conn, adOpenStatic, adLockOptimistic
Set rsRecordset = rs
If rs.EOF Then
Get_Search_RS = 1
Else
Get_Search_RS = 0
End If
End Function
-
Yeah,
the problem is that you don't know how to program!
What do you think a type mismatch is?
what type is 1?
what type are you returning from your function?
this was mentioned in yesterday's thread
why don't you take advice/read replies properly??
-
You really are rude and it seems that you forget that we all started somewhere and were not born with the skill to program. Please do not answer my threads anymore.