Results 1 to 4 of 4

Thread: Dataenvironment SQL

Hybrid View

  1. #1
    Addicted Member
    Join Date
    Mar 00
    Location
    Netherlands
    Posts
    128

    Dataenvironment SQL

    Hi all,

    I realy need some help on this one.

    What I did was imade a VB form I added an Dataenvironment1 and a Datareport1.
    For the Command1 SQL from the datareport I've got :

    SELECT Time, Status, Data
    FROM Messages
    WHERE (Data = 'Test')
    ORDER BY Time


    If I use from my VB form :

    Private Sub Command1_Click()
    DataReport1.Show
    End Sub

    It works fine but what I need is :

    Private Sub Command1_Click()
    dataenvironment1.connection1.command1.SQL = "SELECT Time, Status, Data FROM Messages WHERE (Data = Text1.text) ORDER BY Time
    DataReport1.Show
    End Sub

    Text1.text is a textbox on the same form as the commandbutton.


    Who can help me with this one

    Thanx in advance
    Remember Programmers don't sleep

  2. #2
    Lively Member Surgeon's Avatar
    Join Date
    Oct 00
    Posts
    121

    Cool that sould do it :

    VB Code:
    1. If DataEnvironment1.rsCommand1.State = adStateOpen Then DataEnvironment1.rsCommand1.Close
    2. DataEnvironment1.Command1.CommandText = "SELECT Time, Status, Data " & _
    3.                                         "FROM Messages " & _
    4.                                         "WHERE (Data = """ & Text1.text & """) " & _
    5.                                         "ORDER BY Time;"
    6. DataEnvironment1.Command1
    7. DataReport1.Show
    Cheers,
    Surgeon

  3. #3
    Addicted Member
    Join Date
    Mar 00
    Location
    Netherlands
    Posts
    128

    It doesn't work

    I've got an message (Compile error: Invalid qualifier) on command1


    If DataEnvironment1.rsCommand1.State = adStateOpen Then DataEnvironment1.rsCommand1.Close
    DataEnvironment1.Command1.CommandText = "SELECT Tijd, Status, Data " & _
    "FROM Messages " & _
    "WHERE (Data = """ & lstMeldingenHistory.Text & """) " & _
    "ORDER BY Tijd;"
    DataEnvironment1.Command1
    DataReport1.Show


    Command1
    Remember Programmers don't sleep

  4. #4
    Addicted Member
    Join Date
    Mar 00
    Location
    Netherlands
    Posts
    128

    I've got it

    DataEnvironment1.Commands.Item("Command1").CommandText = "SELECT Tijd, Status, Data " & _
    "FROM Messages " & _
    "WHERE (Data = """ & lstMeldingenHistory.Text & """) " & _
    "ORDER BY Tijd;"
    Remember Programmers don't sleep

Posting Permissions

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