PDA

Click to See Complete Forum and Search --> : DataEnvironment and MS Logic


Zvonko
Jun 27th, 2000, 02:00 AM
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

KGB
Jun 27th, 2000, 05:46 AM
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!!