Quote Originally Posted by royUK View Post
Which link are you referring to? My example will work in any version of Excel
This is the Access Tables and Database thread.

What would be best is for him to Learn some ADO/SQL and use the selection from the combo box to select the record and populate the fields from the data stored.

Something like below:

Sub ComboBox_AfterUpdate()
Dim rsProducts As ADODB.Recordset
Dim strSQL as String
    
On Error GoTo HandleError

    Me!ProductID = Null
    Set rsProducts = New ADODB.Recordset
    If Not IsNull(Me.ProductCode) Then
        strSQL = "Select * From qryProductsExtended Where ProductCode ='" & Me.ProductCode & "'"
        rsProducts.Open strSQL, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
        If Not rsProducts.EOF Then
            With rsProducts
                Me!ProductID = !ProductID
                Me.ProductDescription = !ProductName
                Me.ListPrice = !SupplierListPrice
                Me.Discount = 0
                Me.TaxableItem = !Taxable
                Me.OrderDetailsStatusID = 0
                Me.Quantity.SetFocus
            End With
        Else
            Me.ListPrice = 0
            Me.Discount = 0
            Me.OrderDetailsStatusID = 0
            Me.ProductDescription = "Enter Description Here"
            Me.Quantity.SetFocus
        End If
        rsProducts.Close
        Set rsProducts.ActiveConnection = Nothing
    Else
        eh.TryToRunCommand acCmdDeleteRecord
    End If
    
ExitHere:
    Exit Sub
    
HandleError:
    MsgBox Err.Description
    rsProducts.Close
    Set rsProducts.ActiveConnection = Nothing
    Resume ExitHere

End Sub
Hope this helps,

Dan