Results 1 to 2 of 2

Thread: DataEnvironment and MS Logic

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 1999
    Location
    Ilirska Bistrica, Slovenia
    Posts
    242

    Unhappy

    Hello!

    I have kind an annoying question about Data Environment in VB 6.
    Why is in help described just how to put DataEnvironment command on form and then link it with textboxes, combo boxes and so on. What if you want to put data in control that doesn't have ability for data binding? Then you've got nothing to do. What if you want to process data before you put it into some control? If you have (or if you don't) similar problems, please tell me your opinion. All comments welcome.
    I already tried something through code, but id didn't work out. So if someone had already figured it out, PLEASE tell me.

    Regards
    Zvonko
    Zvonko Bostjancic
    Ilirska Bistrica, Slovenia
    [email protected]
    Using VS6 Professional with SP3
    Programming mostly in VB and I've started to learn VC++ & MFC

  2. #2
    New Member
    Join Date
    Jun 2000
    Location
    South Africa - Pretoria
    Posts
    4
    Here is a simple example of how you can read values from a Dataenvironment command and assign it to a variable. I just used a command button a label and a connection to NWind.mdb were I've selected * from the customers table

    Private Sub Command1_Click()
    Dim strCustomerId As String

    With DataEnvironment1
    ' rsCommand1 is your recordset. You can work
    ' with this exactly like any other recordset.
    If .rsCommand1.State = 1 Then
    .rsCommand1.Close
    End If
    .Command1
    Do Until .rsCommand1.EOF
    strCustomerId = .rsCommand1!CustomerID
    If strCustomerId = "ANTON" Then
    Label1.Caption = strCustomerId

    End If
    .rsCommand1.MoveNext
    Loop

    End With
    End Sub

    I Hope this will help you
    KGB!!

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