Microsoft Access Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseMicrosoft Access Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old January 17th, 2004, 02:06 PM
DM565 DM565 is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 1 DM565 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Cannot DIM a database

Hello all,

I am trying to get the number of records in a table by using a RecordSet and the RecordCount method and putting that number into a label on a form. However, when I use this code in the form_open:

Dim Tname As database
Dim NumRecs As Recordset

Set Tname = CurrentDb
Set NumRecs = tname.OpenRecordset("Lifelist", dbOpenDynaset)

NumRecs.MoveLast

Form.NumRecs.Caption = NumRecs.RecordCount

I get a compile error: user-defined type not defined error on the Dim Tname as database line. Any ideas??

Thanks,
David Moore

Reply With Quote
  #2  
Old January 17th, 2004, 06:14 PM
tony tony is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 4 tony User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I had a similar problem in that when I wrote

"Dim db as database" the drop down list after "as" did not show database. I had to add a reference to the DAO object.
You can set a reference from Microsoft Access, tools menu, while the Module window is open.
This then allowed me to select Database after the "as" and it worked.
Hope this helps

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft Access Help > Cannot DIM a database


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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 On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT