spidermman
10-04-2008, 04:06 AM
This is the new code that I created:
Private Sub Command132_Click()
Dim cnn As ADODB.Connection
Set cnn = CurrentProject.Connection
Dim myRecordSet As New ADODB.Connection
myRecordSet.ActiveConnection = cnn
Dim mySQL As String
mySQL = "SELECT [lifting program].Shipment_Number, [lifting program].product1, [lifting program].product2 "
mySQL = mySQL & " FROM [lifting program]"
mySQL = mySQL & " WHERE ((([lifting program].Shipment_Number) = 690392))"
myRecordSet.Open mySQL
List60.Value = myRecordSet.Fields("product1").Value
List72.Value = myRecordSet.Fields("product2").Value
End Sub
I used a query to obtain 3 fields from the table ?lifting program?.
I created a select query to select a particular shipment number from the shipment_number field. Then I would store the results of the query in a recordset. So I set two list box whereby one list box will contain the product 1 value and the second list box will contain the product 2 value.
However when I run this event procedure, there is no results.
Does anyone knows y?
thanks.
Private Sub Command132_Click()
Dim cnn As ADODB.Connection
Set cnn = CurrentProject.Connection
Dim myRecordSet As New ADODB.Connection
myRecordSet.ActiveConnection = cnn
Dim mySQL As String
mySQL = "SELECT [lifting program].Shipment_Number, [lifting program].product1, [lifting program].product2 "
mySQL = mySQL & " FROM [lifting program]"
mySQL = mySQL & " WHERE ((([lifting program].Shipment_Number) = 690392))"
myRecordSet.Open mySQL
List60.Value = myRecordSet.Fields("product1").Value
List72.Value = myRecordSet.Fields("product2").Value
End Sub
I used a query to obtain 3 fields from the table ?lifting program?.
I created a select query to select a particular shipment number from the shipment_number field. Then I would store the results of the query in a recordset. So I set two list box whereby one list box will contain the product 1 value and the second list box will contain the product 2 value.
However when I run this event procedure, there is no results.
Does anyone knows y?
thanks.