G
Guest
I have a database that is used for product inventory. I have a form that I
scan all the incoming equipment into. This form is attached to a table named
inventorymain.
The field names in inventorymain are Part_Number_ID (this is a text field,
and is the primary key), Model Number (this is a text field), Description
(this is a text field) and Qty (number field).
In another table I have a list of part numbers and a cooresponding
description. The name of this table is Sun Parts the field names are Part
Number This is a text field and is the primary key for this table) and
Part_Description (this is text field).
I need to write a query that will automatically get the Part Description
from Table: Part Description when I enter a part number into the
inventorymain form. I have built a query to recover the data but the query is
based on the part number fields being number fields. And I keep getting a
error each time I try and run it for a text field. Can someone tell me how to
rewrite this?
Private Sub Part_Number_AfterUpdate()
'
Dim intSearch As Integer, varX As Variant
'
intSearch = Me!Part_Number.Value
'
varX = DLookup("[Part_Description]", "Sun_Parts", _
"[Part_Number_ID] = " & intSearch)
'
Me!Part_Description.Value = varX
End Sub
scan all the incoming equipment into. This form is attached to a table named
inventorymain.
The field names in inventorymain are Part_Number_ID (this is a text field,
and is the primary key), Model Number (this is a text field), Description
(this is a text field) and Qty (number field).
In another table I have a list of part numbers and a cooresponding
description. The name of this table is Sun Parts the field names are Part
Number This is a text field and is the primary key for this table) and
Part_Description (this is text field).
I need to write a query that will automatically get the Part Description
from Table: Part Description when I enter a part number into the
inventorymain form. I have built a query to recover the data but the query is
based on the part number fields being number fields. And I keep getting a
error each time I try and run it for a text field. Can someone tell me how to
rewrite this?
Private Sub Part_Number_AfterUpdate()
'
Dim intSearch As Integer, varX As Variant
'
intSearch = Me!Part_Number.Value
'
varX = DLookup("[Part_Description]", "Sun_Parts", _
"[Part_Number_ID] = " & intSearch)
'
Me!Part_Description.Value = varX
End Sub