troubleshooting Question

Lable value from 2 ComboBox

Avatar of Wilder1626
Wilder1626Flag for Canada asked on
Visual Basic Classic
7 Comments1 Solution280 ViewsLast Modified:
Hello again,

I Have a problem with the code. The code is suppose to put the company mane and the adress depending on the value from Combo1 and Combo2, by clicking on a botton.

With the code bellow, it allways put the same company name and adress, no matter what value is in the combo1 and combo2, and i dont know why. Actually, it put the last company name and adress from the last line in the access dbase.

Could you help me agin please?

Thanks again.
Private Sub cmdActiver_Click()
Dim sSQL1 As String
 Dim oRST1 As adodb.Recordset
  Set oRST1 = New adodb.Recordset
    Dim oConnect1 As adodb.Connection
  Set oConnect1 = New adodb.Connection

sSQL1 = "SELECT Nom, Prénom, Compagnie, Adresse  FROM [Table2]"
oConnect1.Open "Provider=Microsoft.ACE.OLEDB.12.0;" & _
"Data Source= C:\Base.accdb;"
'oRST.Open "select * from studentdetails", oConnect
'to THIS
oRST1.Open sSQL1, oConnect1

If Combo1 > "" Then
    Set lblLabel2.DataSource = oRST1
    lblLabel2.DataField = "Compagnie" 'The name of the field you want to follow in the LABEL
    Set Label1.DataSource = oRST1
    Label1.DataField = "Adresse"
    End If
End Sub
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 7 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros