Results 1 to 4 of 4

Thread: DataEnvironment again

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2001
    Location
    Budapest, Hungary
    Posts
    20

    Angry

    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...!

  2. #2
    Fanatic Member
    Join Date
    Jan 2001
    Location
    Vietnam
    Posts
    613
    Try to remove the round bracket, and it should work:

    Code:
    DataEnvironment.Command1 "2001-01-01", "2001-01-31"
    Hope this helps
    TheBao

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Jan 2001
    Location
    Budapest, Hungary
    Posts
    20
    Thanks TheBao!! You are Great.. Now it works well..

    What's the difference between the two syntax ?

  4. #4
    Fanatic Member
    Join Date
    Nov 2000
    Location
    Sydney Australia
    Posts
    804
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width