Microsoft KB Archive/287449

= ACC2002: InputParameter Property Cannot Perform Lookup to Visual Basic for Applications Function =

Article ID: 287449

Article Last Modified on 11/6/2003

-

APPLIES TO


 * Microsoft Access 2002 Standard Edition

-



This article was previously published under Q287449



Moderate: Requires basic macro, coding, and interoperability skills.

This article applies only to a Microsoft Access project (.adp).



SYMPTOMS
When you try to evaluate an input parameter in a function that is referenced in the RecordSource property of a form, the InputParameter property is properly populated. However, you receive the following error message when you open the form and supply a valid input parameter:

Invalid SQL Statement.

Check the server filter on the form record source.



CAUSE
This is a limitation in Microsoft Access. Access performs basic evaluation of object references, but Access does not perform Visual Basic for Applications function evaluation.



RESOLUTION
Set the record source of the form to an SQL statement that accepts parameters, similar to the following: SELECT * FROM Products WHERE CategoryID = ? You must also set the InputParameter property equal to a reference to the function, similar to the following: lGetValue



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.



Steps to Reproduce the Behavior
 Start Access 2002, and then open the sample project NorthwindCS.adp.  Add a new module, and then type or paste the following code: Public Function lGetValue lGetValue = 2 End Function  Save the module.  Open the Products form in Design view. On the Data tab, modify the Recordsource property as follows: SELECT * FROM Products WHERE CategoryID = @lGetValue  Save the form with a new name, and then switch the form to Form view.</li> When you are prompted for the parameter, enter a value, such as 5. Note that you receive the error message that is mentioned in the &quot;Symptoms&quot; section of this article.</li></ol>

Additional query words: pra inputparameter lookup function can't OfficeErrorMessages 10022

Keywords: kberrmsg kbbug kbnofix KB287449

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.