-
Hello!
DataEnv problem again..
Im using DataEnv to create DataReports.
I need to pass parameters to DataEnv to customize the
SQL query.
If Im using only one parameter everything works well..
Like this:
DataEnviroment.Command1( "2001-01-01" )
BUT!!!
If I use an second parameter like this:
DataEnvironment.Command1
("2001-01-01", "2001-01-31")
I get an error message:
Compile Error:
Expected: =
I don't understand it. What do I wrong????
please help...!
-
Try to remove the round bracket, and it should work:
Code:
DataEnvironment.Command1 "2001-01-01", "2001-01-31"
Hope this helps
TheBao
-
Thanks TheBao!! You are Great.. Now it works well..
What's the difference between the two syntax ?
-
Generally you use brackets to denote the calling of a function and thus you require something back. If you don't require anything back call the function without the brackets. The difference is one is a function call the other is a statement.
eg
sub test
dim int as integer
int = msgbox("Choose",vbyesNo) ' call function
msgbox int 'statement
end test
There are always exceptions, one that I can think of is using the keyword call, to call a function. In this case you must call the function using brackets but don't have to set up a variable to hold the result.
eg
Code:
Private Sub Command1_Click()
Call DisplayString("example of breaking the rules")
End Sub
Private Function DisplayString(str As String)
MsgBox str
End Function
Hope this helps
James