It's been a long time since I used Acces and VBA !

I am trying to use a combo box (lookup query) in a subform and once the match occurs I would like the rest of the fields in the subform to be updated accordingly


table : course

fields : Course, Item and Cost


fields: Course, Item, Cost and Quantity

Once Item in the subform cobobox is selected from the query I would like it to update both the course and cost fields of the combo box.

What relationships do i need to set up

and what is wrong with my VBA code for Dynamic Lookup ?

Private Sub Combo8_AfterUpdate()

Exit Sub

Dim strFilter As String

' Evaluate filter before it's passed to DLookup function.
strFilter = "item= " & Me!Item

' Look up product's unit price and assign it to UnitPrice control.
Me!Cost = DLookup("Cost", "Course", strFilter)

Exit Sub

// would like to lookup item and return cost and course.

Any help would be most appreciated