Microsoft KB Archive/100147: Difference between revisions
From BetaArchive Wiki
(importing KB archive) |
m (Text replacement - """ to """) |
||
Line 22: | Line 22: | ||
== SYMPTOMS == | == SYMPTOMS == | ||
When you are using the OpenQueryDef method on a parameter query, the error message | When you are using the OpenQueryDef method on a parameter query, the error message "Couldn't Find Object" appears when you re-create the sample code on page 137 of the Microsoft Access "Introduction to Programming" manual. | ||
<br /> | <br /> | ||
Line 43: | Line 43: | ||
== RESOLUTION == | == RESOLUTION == | ||
The following sample function is a correction to the errors in the sample on page 137 of the Microsoft Access | The following sample function is a correction to the errors in the sample on page 137 of the Microsoft Access "Introduction to Programming" manual:<br /> | ||
Line 54: | Line 54: | ||
Dim db As Database, Q As QueryDef, DataRecs As Dynaset | Dim db As Database, Q As QueryDef, DataRecs As Dynaset | ||
Set db = CurrentDB() | Set db = CurrentDB() | ||
Set Q = db.OpenQueryDef( | Set Q = db.OpenQueryDef("Products by Category (Parameter)") | ||
Q![Enter a category id:] = | Q![Enter a category id:] = "COND" 'This is an explicit parameter | ||
Set DataRecs = Q.CreateDynaset() | Set DataRecs = Q.CreateDynaset() |
Latest revision as of 13:55, 19 July 2020
ACC1x: Error When Using OpenQueryDef Method on Parameter Query |
Q100147
The information in this article applies to:
- Microsoft Access versions 1.0, 1.1
SYMPTOMS
When you are using the OpenQueryDef method on a parameter query, the error message "Couldn't Find Object" appears when you re-create the sample code on page 137 of the Microsoft Access "Introduction to Programming" manual.
CAUSE
There are three likely causes for this error message:
- The name of the query you are trying to open is misspelled
- The parameter is misspelled
- The parameter is not explicitly defined
In the sample code on page 137, both the query name and the parameter are misspelled.
RESOLUTION
The following sample function is a correction to the errors in the sample on page 137 of the Microsoft Access "Introduction to Programming" manual:
'***************************************************************** ' Declarations section of the module '***************************************************************** Option Explicit Function TestQP () Dim db As Database, Q As QueryDef, DataRecs As Dynaset Set db = CurrentDB() Set Q = db.OpenQueryDef("Products by Category (Parameter)") Q![Enter a category id:] = "COND" 'This is an explicit parameter Set DataRecs = Q.CreateDynaset() DataRecs.Close Q.Close End Function
Keywords : kberrmsg kbprg
Issue type :
Technology :
Last Reviewed: November 4, 2000 |