Error Using Call Statement with Function ProcedureLast reviewed: July 29, 1997Article ID: Q114696 |
The information in this article applies to:
SYMPTOMSIn a Microsoft Visual Basic Programming System, Applications Edition, procedure, if you enter the Call statement followed by a Function procedure and the function name contains a type-declaration character, you receive the following error message:
Expected: Identifier without type suffix or bracketed expression or .If you clear the Display Syntax Errors check box on the Module General tab of the Options dialog box, or you ignore the above error message, you receive a syntax error when you run the procedure that contains this Call statement.
STATUSMicrosoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.
CAUSEThis problem occurs because when you use the Call statement to call a Function procedure, the return value is discarded. If you call a Function procedure as you would call a Sub procedure, using the Call statement, the Function procedure name must follow the Sub procedure naming rules, and a Sub procedure name cannot contain a type-declaration character. WORKAROUNDTo avoid receiving this error message, or a syntax error when you run a Function procedure, do either of the following:
MORE INFORMATIONA type-declaration character is a character that you can add to the end of a variable name to indicate the data type of the variable. For example, to declare a variable as string type, you can append the $ to the variable name as follows:
Name$ = "Chris"A function name can contain a type-declaration character; the function will run when you call the function using the function name. For example, to call the function Test$(), you can call the function in a procedure using the following syntax without receiving an error message:
Test$However, when you use the Call statement to run a function, you receive the above error message when you press ENTER at the end of the line that contains the Call statement if the function name contains a type- declaration character. For example, you receive the error message when you press ENTER at the end of the following line of code:
Call Test$ REFERENCESFor a definition of the Type-Declaration Character, choose the Search button in the Visual Basic Reference and type:
type-declaration characterFor more information about the Call statement, choose the Search button in the Visual Basic Reference and type:
call |
Additional query words: errmsg err msg
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |