|
-
Jun 14th, 2002, 11:54 PM
#1
Thread Starter
New Member
Problem returning Recordset
Hi
I am trying to return a recordset from a function in a class back to my form in order to display the data.
Code is as follows:
In my Form -
Dim bs as New Bookstore
Public rsResult = New ADODB.Recordset
Private Sub mnuBook_Click()
Dim strIsbn As String
strIsbn = InputBox("Enter the ISBN", "Search by ISBN")
If strIsbn = "" Then
MsgBox "No ISBN entered", vbOKOnly, "Search"
Else
Showdata(bs.findbyIsbn(strIsbn))
End If
End Sub
Private Sub Showdata(rsResult As ADODB.Recordset)
txtIsbn.Text = rsResult.Fields("ISBN")
(...display into all my other text boxes....)
End Sub
and in my Bookstore Class:
Public Function findbyIsbn(strIsbn As String) As ADODB.Recordset
Dim rsResult As New ADODB.Recordset
Dim strSQL As String
strSQL = "SELECT Author.*, Books.* FROM Author INNER JOIN Books ON Author.[Author Code] = Books.[Author Code] WHERE (Books.ISBN)='" & strIsbn & "';"
rsResult.Open strSQL, mcon1, adOpenDynamic, adLockOptimistic
Set findbyIsbn = rsResult
End Function
The problem is I get a Type Mismatch error on the - Showdata(bs.findbyIsbn(strIsbn)) - line of code in my form
Its probably something really simply, but I fairly new to VB and any advice would be appreciated
Cheers
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|