A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Trouble With Recordsets



 
 
Thread Tools Display Modes
  #1  
Old January 24th, 2007, 10:44 PM
Jeff Monroe Jeff Monroe is offline
Member
 
First recorded activity by OfficeFrustration: May 2006
Location: San Diego, CA
Posts: 27
Default Trouble With Recordsets

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
  #2  
Old January 26th, 2007, 03:54 AM posted to microsoft.public.access.forms
strive4peace
external usenet poster
 
Posts: 1,670
Default Trouble With Recordsets

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




  #3  
Old January 26th, 2007, 04:50 PM
Jeff Monroe Jeff Monroe is offline
Member
 
First recorded activity by OfficeFrustration: May 2006
Location: San Diego, CA
Posts: 27
Default

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

Quote:
Originally Posted by 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
*



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



  #4  
Old January 26th, 2007, 05:53 PM posted to microsoft.public.access.forms
Douglas J. Steele
external usenet poster
 
Posts: 9,313
Default Trouble With Recordsets

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
http://I.Am/DougSteele
(no e-mails, please!)


"Jeff Monroe" wrote in message
...

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

strive4peace Wrote:
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



-





--
Jeff Monroe



  #5  
Old January 29th, 2007, 04:41 AM
Jeff Monroe Jeff Monroe is offline
Member
 
First recorded activity by OfficeFrustration: May 2006
Location: San Diego, CA
Posts: 27
Default

Doug:

Now that you mention it, the book directs the reader to use the 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 used the Northwind.mdb file, thinking it miht have been a typo?

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

Thanks.

Jeff

Quote:
Originally Posted by 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
  #6  
Old January 29th, 2007, 03:56 PM posted to microsoft.public.access.forms
Douglas J. Steele
external usenet poster
 
Posts: 9,313
Default Trouble With Recordsets

To use an ADP, you'd have to have SQL Server installed.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Jeff Monroe" wrote in message
...

Doug:

Now that you mention it, the book directs the reader to use the
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 used
the Northwind.mdb file, thinking it miht have been a typo?

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

Thanks.

Jeff

Jeff Monroe Wrote:
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





--
Jeff Monroe



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 11:34 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.