Hi,
We've only recently switched our systems over from Office 97 to XP; now the VB in the back of lots of my databases doesn't seem to work anymore. This code now produces all sorts of errors:
(the vars sqlSearch and qryName are two string set in other mods)
Now I get all sorts of errors when I run this. I realise Access went through a fairly serious facelift re objects and the OO side of VB around 2000. Has this to do with DAO to ADO? (This area ia a little sketchy with me to be honest)
And if so where can I get good online help that'll take me through this step by step. A beginners guide to the object hierarchy within Access if you like. Picking through the help files within Access is absolutely useless - as far as I'm concerned they're rubbish and still contains lots of examples using code like the example above even though it won't work!!!
Help
Liam
We've only recently switched our systems over from Office 97 to XP; now the VB in the back of lots of my databases doesn't seem to work anymore. This code now produces all sorts of errors:
(the vars sqlSearch and qryName are two string set in other mods)
Code:
' @var dbs a database object
Dim dbs As Database
' @var qdf a query definition object
Dim qdf As QueryDef
' create an external query based on this sql string which the report will be able to access
' Return reference to current database.
Set dbs = CurrentDb
' refresh the list of queries currently in the DB
dbs.QueryDefs.Refresh
' search through each of the query defs in the DB and if "qryBlockViewSearch" exists delete it
For Each qdf In dbs.QueryDefs
If qdf.Name = qryName Then
' delete the query
dbs.QueryDefs.Delete qdf.Name
End If
Next qdf
' After any trace of "qryBlockViewSearch" has been removed create a new version of this query
Set qdf = dbs.CreateQueryDef(qryName)
' apply the sqlstring to this query
qdf.SQL = sqlSearch
' Create snapshot-type Recordset object from QueryDef object.
Set rst = qdf.OpenRecordset(dbOpenSnapshot)
' close the recordset object
rst.Close
' set the database object to nothing
Set dbs = Nothing
Now I get all sorts of errors when I run this. I realise Access went through a fairly serious facelift re objects and the OO side of VB around 2000. Has this to do with DAO to ADO? (This area ia a little sketchy with me to be honest)
And if so where can I get good online help that'll take me through this step by step. A beginners guide to the object hierarchy within Access if you like. Picking through the help files within Access is absolutely useless - as far as I'm concerned they're rubbish and still contains lots of examples using code like the example above even though it won't work!!!
Help

Liam