Code:
Private Sub cboComponent_Change()
'Pseudo-autofill for Description and UOM based on Component entry
If (Me.cboComponent = "PartNumber") Then
'Autofill if the search directly yields a part
Me.txtComponent = cboComponent.Column(0)
Me.txtDescription = cboComponent.Column(1)
Me.txtUOM = cboComponent.Column(2)
Me.txtAlternateA = DLookup("AlternateA", "ALTERNATES", "ID=" & Me.cboComponent)
Me.txtAlternateB = DLookup("AlternateB", "ALTERNATES", "ID=" & Me.cboComponent)
Me.txtAltADescription = txtAlternateA.Column(1)
Me.txtAltAUOM = txtAlternateA.Column(2)
Me.txtAltBDescription = txtAlternateB.Column(1)
Me.txtAltBUOM = txtAlternateB.Column(2)
Else
'Autofill if the search directly yields a drawing number
Me.txtAlternateA = DLookup("AlternateA", "DRAWINGS", "ID=" & Me.cboComponent)
Me.txtAlternateB = DLookup("AlternateB", "DRAWINGS", "ID=" & Me.cboComponent)
Me.txtAltADescription = txtAlternateA.Column(1)
Me.txtAltAUOM = txtAlternateA.Column(2)
Me.txtAltBDescription = txtAlternateB.Column(1)
Me.txtAltBUOM = txtAlternateB.Column(2)
Me.txtComponent = DLookup("Primary", "DRAWINGS", "ID=" & Me.cboComponent)
Me.txtDescription = cboComponent.Column(1)
Me.txtUOM = cboComponent.Column(2)
End If
End Sub
Autofill code. When I start typing in the combobox with the list of parts and drawing numbers I get run time error '2471':
The expression you entered as a query parameter produced this error: 'ID'