Don't know if it is just a typing error but you have a space after the first
apostrophe.
The line should be
org = DLookup("shape","tbl_vehmodel","model = '" & pName & "'")
Also DLookup will only return 1 value, so why are using a combo box to
display 1 value ?
"pedro" wrote:
> I am trying to auto-fill a combo-box on a form based on the selection from
> another combo-box.
>
> It is triggered on an after update event on the first combo-box selection.
> The code I have is;
>
> If not IsNull([Vehicle Model]) Then
> Dim org as Variant
> Dim pName As String
> pName = [Vehicle Model].value
>
> org = DLookup("shape","tbl_vehmodel","model = ' " & pName & "'")
>
> End If
>
> Shape is a field in the table tbl_vehmodel that I want to lookup based on
> the name of the vehicle model selected in the combo-box. The combo-box I want
> to auto-fill is called Vehicle Shape.
>
> The syntax runs without errors however the Vehicle Shape field is not
> populated.
>
> Your suggestions would be greatly appreciated.
|