|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 |
|
#2
|
|||
|
|||
|
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 |
![]() |
| Viewing: ASP Free Forums > Database > Microsoft Access Help > Cannot DIM a database |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|