ScoobyNet.com - Subaru Enthusiast Forum

ScoobyNet.com - Subaru Enthusiast Forum (https://www.scoobynet.com/)
-   Non Scooby Related (https://www.scoobynet.com/non-scooby-related-4/)
-   -   Any Access2000 / Visual Basic programmers here ? (https://www.scoobynet.com/non-scooby-related-4/18092-any-access2000-visual-basic-programmers-here.html)

DazV 19 August 2001 03:14 PM

As Scoobynet is the oracle of all info...

Just wondering if anyone can tell me - in the earlier versions of access, eg. access97, the following was ok:

Dim dbs As Database
Dim rst As Recordset

Trouble is, using Access2000, I'm getting a compile error and its pointing to the above lines as the source of the error - anyone know if they replaced the 'database' object in Access2000, and if so, what is the replacement code ?

Full code snippet:
Set dbs = CurrentDb()
strSQL = "SELECT * FROM [Switchboard Items]"
strSQL = strSQL & " WHERE [ItemNumber] > 0 AND [SwitchboardID]=" & Me![SwitchboardID]
strSQL = strSQL & " ORDER BY [ItemNumber];"
Set rst = dbs.OpenRecordset(strSQL)

ChrisB 19 August 2001 04:08 PM

Daz,

From a Visual Basic code edit window without the code running...

Click Tools > References

From the list of ticked references, do you have any called something like "Microsoft DAO xxxx Object Library".

If not, scroll down the list and you should have a choice of a few. On this PC (Win 2000 Pro + Office 2000 Pro), I have the following...

MS DAO 2.5/3.51 Compatability Library
MS DAO 3.51 Object Library
MS DAO 3.6 Object Library

Tick one, click OK and your code should work.

Actually, do any of the ticked references at the top of the list have MISSING against them? Even if you are not using a function or type from the library marked MISSING, Access will often refuse to compile or run code until the tick is removed from the module or it is installed.

HTH,

ChrisB.

KF 19 August 2001 04:21 PM

Shot in the dark from someone with no Access 2000 and little VB...
Could it be a DAO 3.6 problem?
Have you set a permanent reference to the DAO 3.6 Object library?
The code looks to be OK.
Good luck!
KF.

KF 19 August 2001 04:25 PM

Haha... http://bbs.scoobynet.co.uk/smile.gif
Was composing whilst ChrisB was posting... Looks like DAO could be the culprit.

DazV 19 August 2001 05:15 PM

Thanks all.

Looks like the code was written for an earlier version of Access, and hasn't been converted properly to run on Access2000.

I'll try that tools > options thing.


All times are GMT +1. The time now is 03:35 AM.


© 2024 MH Sub I, LLC dba Internet Brands