|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
var as Database won't work in Access 2K- help
my objective is simply to see if a table has any records in it. In access 97, here is the code I use, and it does the job:
(I know this is VBA, but I thought using the php tag would make it easier to read) PHP Code:
the error message is: "Compile error: User-defined type not defined" and it's referring to the "As Database" bit. Apparently "Database" is not a valid object or class (or whatever) in Access 2000, though it was in '97. So, any thoughts on what I can do? All I really need is for it to look in my table and tell me if it has any records. There must be an easy way to do that |
|
#2
|
|||
|
|||
|
U can try to install MDAC2.8 http://msdn.microsoft.com/isapi/gom...&DisplayLang=en ..And Retry to recpomlie the project..
|
|
#3
|
|||
|
|||
|
I'm a bit of a beginner.. I have Access 97 and 2000 both installed on my PC- if it works on 97, would installing that MDAC2 still help? thanks for your reply, though. I'll probably try it later tonight, just to see
|
|
#4
|
|||
|
|||
|
Try adding a reference to DAO in your Access 2000 project. In the VBA editor choose Tools - References
|
|
#5
|
|||
|
|||
|
Quote:
wow, I can't beleive it was that simple. Thanks for the help, guys. Could you take a look at the code, though? I'm thinking there must be an easier way to check a table to see if there's anything in it. Any ideas for that? |
|
#6
|
|||
|
|||
|
Would u check the table exists or inexists??
This code u can try: dim db as database, td as tabledef set db = currentdb() on error resume next set td = db.tabledefs("MyTable") if err.number <> 0 then set td = nothing on error goto 0 if td is nothing then ' table did not exist. else ' table exists, and its properties are in td. ... set td = nothing endif set db = nothing To check in some other database, use: set db = dbengine.opendatabase ("path to other database") and add as the second-last line: db.close |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > var as Database won't work in Access 2K- help |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|