OK, so I've been playing with this for too long, not getting it to work.
Seems pretty simple, and I'm sure I'm just klutzing some syntax, but...
I need to update the description property of queries via code. I know that
the property doesn't exist unless it's been set, because it's an Access
property tagged onto a Jet object. I've searched a bunch on google and read
the help topic about four times (which is not an assertion that the answer's
not in there). I've checked references and not noticed anything that would
hold me back, but maybe I'm missing something there.
I cribbed some test code that works just fine in 97 but won't work in 2002,
which is where I need it. This works for a query that has never had a
description. I haven't run it on one that does, because I'm just trying to
get this down first. When I run this:
Sub setTheDesc()
Dim MyQuery As QueryDef
Dim myDB As Database
Dim myProperty As Property
Dim VarValue As Variant
VarValue = "works here"
Set myDB = CurrentDb
Set MyQuery = myDB.QueryDefs( "qry3")
Set myProperty = MyQuery.CreateP roperty("Descri ption", dbText, VarValue)
Call MyQuery.Propert ies.Append(myPr operty)
End Sub
I get a type mismatch error on the "Set myProperty..." line. The same exact
code works fine in 97. What do I need to do to get this to work in 2002?
Thanks for any help.
Jeremy
--
Jeremy Wallace
AlphaBet City Dataworks
Seems pretty simple, and I'm sure I'm just klutzing some syntax, but...
I need to update the description property of queries via code. I know that
the property doesn't exist unless it's been set, because it's an Access
property tagged onto a Jet object. I've searched a bunch on google and read
the help topic about four times (which is not an assertion that the answer's
not in there). I've checked references and not noticed anything that would
hold me back, but maybe I'm missing something there.
I cribbed some test code that works just fine in 97 but won't work in 2002,
which is where I need it. This works for a query that has never had a
description. I haven't run it on one that does, because I'm just trying to
get this down first. When I run this:
Sub setTheDesc()
Dim MyQuery As QueryDef
Dim myDB As Database
Dim myProperty As Property
Dim VarValue As Variant
VarValue = "works here"
Set myDB = CurrentDb
Set MyQuery = myDB.QueryDefs( "qry3")
Set myProperty = MyQuery.CreateP roperty("Descri ption", dbText, VarValue)
Call MyQuery.Propert ies.Append(myPr operty)
End Sub
I get a type mismatch error on the "Set myProperty..." line. The same exact
code works fine in 97. What do I need to do to get this to work in 2002?
Thanks for any help.
Jeremy
--
Jeremy Wallace
AlphaBet City Dataworks
Comment