Trouble With Recordsets

J

Jeff Monroe

I have a form with navigation buttons (First, Next, Previous, Last
New). I am trying to make them "Smart" by enabling and disabling the
as per the position in the recordset (with the help of a boo
tutorial).

When I try to use the form I get a "Run-time error '13': Typ
mismatch". When I click debug the code that is highlighted is "Se
rstClone = frm.RecordsetClone". Here is a sample of the first part o
the code:

Public Function DisablEnable(frm As Form)
Dim rstClone As ADODB.Recordset

Set rstClone = frm.RecordsetClone

If frm.NewRecord Then
frm!cmdFirst.Enabled = True
frm!cmdNext.Enabled = False
frm!cmdPrevious.Enabled = True
frm!cmdLast.Enabled = True
frm!cmdNew.Enabled = False
Exit Function
End If
....
End Function

The public function is kept in a module (basNavigationButtons) and I a
calling the function in the forms On Current event
=DisablEnable([Form]) ). Lastly, I am using Access 2003.

PS: I have found this same error when using Set rstClone
frm.RecordsetClone, but could not figure out why. I just had to mov
on.

Jeff Monro
 
S

strive4peace

Hi Jeff,

Dim rstClone As dao.Recordset

Warm Regards,
Crystal
*
:) have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*
 
J

Jeff Monroe

Crystal:

That worked, thanks.

Do you have any idea why the tutorial book uses ADODB.Recordset? It's
throughout the whole chapter? Does it have anything to do witht the
references selected? Version of Access? I emailed the author but have
not received a response.

Jeff
Hi Jeff,

Dim rstClone As dao.Recordset

Warm Regards,
Crystal
*
:) have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*



Jeff Monroe wrote:-
I have a form with navigation buttons (First, Next, Previous, Last,
New). I am trying to make them "Smart" by enabling and disabling them
as per the position in the recordset (with the help of a book
tutorial).

When I try to use the form I get a "Run-time error '13': Type
mismatch". When I click debug the code that is highlighted is "Set
rstClone = frm.RecordsetClone". Here is a sample of the first part of
the code:

Public Function DisablEnable(frm As Form)
Dim rstClone As ADODB.Recordset

Set rstClone = frm.RecordsetClone

If frm.NewRecord Then
frm!cmdFirst.Enabled = True
frm!cmdNext.Enabled = False
frm!cmdPrevious.Enabled = True
frm!cmdLast.Enabled = True
frm!cmdNew.Enabled = False
Exit Function
End If
...
End Function

The public function is kept in a module (basNavigationButtons) and I
am
calling the function in the forms On Current event (
=DisablEnable([Form]) ). Lastly, I am using Access 2003.

PS: I have found this same error when using Set rstClone =
frm.RecordsetClone, but could not figure out why. I just had to move
on.

Jeff Monroe



-
 
D

Douglas J. Steele

You sure the code is for an MDB, and not an ADP?

Also, are you sure it's using frm.RecordsetClone, and not
frm.Recordset.Clone?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Jeff Monroe said:
Crystal:

That worked, thanks.

Do you have any idea why the tutorial book uses ADODB.Recordset? It's
throughout the whole chapter? Does it have anything to do witht the
references selected? Version of Access? I emailed the author but have
not received a response.

Jeff
Hi Jeff,

Dim rstClone As dao.Recordset

Warm Regards,
Crystal
*
:) have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*



Jeff Monroe wrote:-
I have a form with navigation buttons (First, Next, Previous, Last,
New). I am trying to make them "Smart" by enabling and disabling them
as per the position in the recordset (with the help of a book
tutorial).

When I try to use the form I get a "Run-time error '13': Type
mismatch". When I click debug the code that is highlighted is "Set
rstClone = frm.RecordsetClone". Here is a sample of the first part of
the code:

Public Function DisablEnable(frm As Form)
Dim rstClone As ADODB.Recordset

Set rstClone = frm.RecordsetClone

If frm.NewRecord Then
frm!cmdFirst.Enabled = True
frm!cmdNext.Enabled = False
frm!cmdPrevious.Enabled = True
frm!cmdLast.Enabled = True
frm!cmdNew.Enabled = False
Exit Function
End If
...
End Function

The public function is kept in a module (basNavigationButtons) and I
am
calling the function in the forms On Current event (
=DisablEnable([Form]) ). Lastly, I am using Access 2003.

PS: I have found this same error when using Set rstClone =
frm.RecordsetClone, but could not figure out why. I just had to move
on.

Jeff Monroe



-
 
J

Jeff Monroe

Doug:

Now that you mention it, the book directs the reader to use th
Norhtwind.ADP (supplied on the dis) database. When I tried to use it
it didn't work (it couldn't find the datatables). I went adead and use
the Northwind.mdb file, thinking it miht have been a typo?

The book wasn't real clear (or helpful) with explaining th
significance of an .adp file. I even emailed the author and failed t
receive a response.

Thanks.

Jeff
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top