I cannot understand what the problem with the following code is. It's from a function in a code module (Access 2000):
I get "ERROR: User-defined type not defined" on the first line. EH?!? It doesn't appear to recognise the word 'Database' at all, as it doesn't capitalise it when I type it in lowercase
Why is it giving me that error? I've seen that sort of thing written a dozen times!
Set TheRecords = DB.OpenRecordset("querytext", dbOpenSnapshot) doesn't work (obviously, considering the above), so I tried the following instead as the next bit of code:
This gives me an error "invalid argument"... interestingly, dbOpenShapshot is said to be empty when I inspect it in debug mode.
"Type mismatch" this time.
The following code works for some reason:
What is going on? 'Database' types are defined in code samples all over the place, so why is Access playing dumn? And what's wrong with 'dbOpenShapshot'?
Code:
Dim DB as Database
Set DB = CurrentDB
Dim TheRecords as Recordset 'No problems here
I get "ERROR: User-defined type not defined" on the first line. EH?!? It doesn't appear to recognise the word 'Database' at all, as it doesn't capitalise it when I type it in lowercase
Why is it giving me that error? I've seen that sort of thing written a dozen times!
Set TheRecords = DB.OpenRecordset("querytext", dbOpenSnapshot) doesn't work (obviously, considering the above), so I tried the following instead as the next bit of code:
Code:
Set TheRecords = CurrentDb.OpenRecordset("querytext", dbOpenSnapshot)
This gives me an error "invalid argument"... interestingly, dbOpenShapshot is said to be empty when I inspect it in debug mode.
Code:
Set TheRecords = CurrentDb.OpenRecordset("querytext")
"Type mismatch" this time.
The following code works for some reason:
Code:
Dim TheRecords as Object
Set TheRecords = CurrentDb.OpenRecordset("querytext")
What is going on? 'Database' types are defined in code samples all over the place, so why is Access playing dumn? And what's wrong with 'dbOpenShapshot'?