Heenan, Lambert 
      Lambert.Heenan at AIG.com
      
      Wed May  7 12:08:08 CDT 2008
    
FYI. The type mismatch error was because int_X is an Integer, but
RecordCount is a Long. 
Lambert
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Doug Murphy
Sent: Wednesday, May 07, 2008 12:06 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Simple Recordset Question
Thanks Gustav,even Better.
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Gustav Brock
Sent: Wednesday, May 07, 2008 1:54 AM
To: accessd at databaseadvisors.com
Subject: Re: [AccessD] Simple Recordset Question
Hi Doug and Steve
You don't even need "somefield":
  lngCount = DCount("*", "Matrix")
/gustav
>>> dw-murphy at cox.net 07-05-2008 04:51 >>>
Why not just use dcount("somefield","Matrix")?  One line.
Doug 
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Steve Zayko
Sent: Tuesday, May 06, 2008 3:10 PM
To: Access Developers discussion and problem solving
Subject: [AccessD] Simple Recordset Question
OK, I have a first grader level question for you all.
I have an access 2003 database and a form.  When I click a button on said
form I would like the code to open a table as a recordset and count the
records.  I know I have done this before and I know I have seen this done
quite easily.  However, I am getting an error that I cannot get past.
This is my code:
Dim rst_Matrix As Recordset
Dim int_X as integer
Set rst_Matrix = CurrentDb.OpenRecordset("SELECT Matrix.* from Matrix;", _
DbOpenDynaset, dbReadOnly)
rst_Matrix.MoveLast
int_X = rst_Matrix.RecordCount
On line 3 I am getting a type mis-match.  
What am I doing wrong and how do I get my code to get past this?
Thanks
-Z
Stephen Zayko, PE
Associate Engineer
Stantec
2321 Club Meridian Drive Suite E
Okemos MI 48864
Ph:   (517) 349-9499 Ext. 224
Fx:    (517) 349-6863
Cell: (517) 204-5136
steve.zayko at stantec.com
www.stantec.com 
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com