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 » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Run-time error '13': Type mismatch



 
 
Thread Tools Display Modes
  #1  
Old December 4th, 2005, 10:36 AM posted to microsoft.public.access.reports
external usenet poster
 
Posts: n/a
Default Run-time error '13': Type mismatch

I call this procedure from the Report_Open event, and am getting the error
shown on the 6th line below.
I'm trying to find out how many records (if any) are in the table
"tblSelectMainReport".
Can you explain the error, or a better way to find out the number of records
in the table?

Thanks,
Bernie

Private Sub CountTheErrors()
Dim dbs As Database, rst As Recordset, X As Integer, strName As String
Dim strDocName As String
Set dbs = CurrentDb
strDocName = "tblSelectMainReport"
Set rst = dbs.OpenRecordset(strDocName) 'ERROR HE Type mismatch
MsgBox rst.RecordCount
rst.Close
Set dbs = Nothing
End Sub


  #2  
Old December 4th, 2005, 10:55 AM posted to microsoft.public.access.reports
external usenet poster
 
Posts: n/a
Default Run-time error '13': Type mismatch

Try:
Dim dbs As Database, rst As DAO.Recordset, X As Integer, strName As
String

Both the DAO library and the ADO library have a Recordset object. If you do
not specify which one you want, you get whichever one is listed first under
Tools | References (from a code window.)

You can solve the problem by any of the following:
a) Remove the ADO library if you don't need it.
b) Move the DAO library above ADO so it has a higher priority.
c) Explicitly disambiguate, as in the example above.

More info on which references are needed for which versions of Access:
http://allenbrowne.com/ser-38.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"bw" wrote in message
...
I call this procedure from the Report_Open event, and am getting the error
shown on the 6th line below.
I'm trying to find out how many records (if any) are in the table
"tblSelectMainReport".
Can you explain the error, or a better way to find out the number of
records in the table?

Thanks,
Bernie

Private Sub CountTheErrors()
Dim dbs As Database, rst As Recordset, X As Integer, strName As String
Dim strDocName As String
Set dbs = CurrentDb
strDocName = "tblSelectMainReport"
Set rst = dbs.OpenRecordset(strDocName) 'ERROR HE Type mismatch
MsgBox rst.RecordCount
rst.Close
Set dbs = Nothing
End Sub



  #3  
Old December 4th, 2005, 01:30 PM posted to microsoft.public.access.reports
external usenet poster
 
Posts: n/a
Default Run-time error '13': Type mismatch

Thanks,Allen!

I was going to follow up with more questions about this, but I guess you new
I would, and so included the link to your explanation for "Solving Problems
with Library References".

As always, I appreciate your help.
Bernie


"Allen Browne" wrote in message
...
Try:
Dim dbs As Database, rst As DAO.Recordset, X As Integer, strName As
String

Both the DAO library and the ADO library have a Recordset object. If you
do not specify which one you want, you get whichever one is listed first
under Tools | References (from a code window.)

You can solve the problem by any of the following:
a) Remove the ADO library if you don't need it.
b) Move the DAO library above ADO so it has a higher priority.
c) Explicitly disambiguate, as in the example above.

More info on which references are needed for which versions of Access:
http://allenbrowne.com/ser-38.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"bw" wrote in message
...
I call this procedure from the Report_Open event, and am getting the error
shown on the 6th line below.
I'm trying to find out how many records (if any) are in the table
"tblSelectMainReport".
Can you explain the error, or a better way to find out the number of
records in the table?

Thanks,
Bernie

Private Sub CountTheErrors()
Dim dbs As Database, rst As Recordset, X As Integer, strName As String
Dim strDocName As String
Set dbs = CurrentDb
strDocName = "tblSelectMainReport"
Set rst = dbs.OpenRecordset(strDocName) 'ERROR HE Type mismatch
MsgBox rst.RecordCount
rst.Close
Set dbs = Nothing
End Sub





 




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

Similar Threads
Thread Thread Starter Forum Replies Last Post
how do i type a time into a cell formatted for time? Armadillo General Discussion 4 June 16th, 2005 11:32 PM
Data Type Mismatch problem SMelissaK General Discussion 0 February 24th, 2005 07:03 PM
Outlook 2003 Terminal Server Time Zone issue Robert Strom Calendar 2 May 26th, 2004 10:50 PM
Trying to count the number or customers of type x for subsequent time intervals Earl Kiosterud Worksheet Functions 0 May 3rd, 2004 05:05 AM


All times are GMT +1. The time now is 05:17 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.