S
Shawna
I am trying to update a field in an access table based on
certain criteria. What I need to do is update a
description field with the appropriate text from other
tables based on the part number field. I have the sql
statement written as I need it but I am having trouble
with how to set the criteria to only update the
appropriate records.
Specifically here is what I need to do.
I have a part number ie. A15PSIBC - each letter/number in
this code represents part of the description - i.e A is
Aluminum, 15 is the size, P is a labour type, etc. I have
all the tables set up to 'build' the description for this
part number and I have the SQL statement (in VB) to
update the parts table with the description - that part
is working fine. Where I am running into trouble is I
need the description built based on different tables
based on the Item Type (the first letter of the Part
number)
What I thought would work is to open the item table as a
recordset (table I need to update).
Do while not rst.eof
'get first letter from Item no to set Item Type
sItemType = Left(ItemMaster!ItemNo, 1)
if sItemType = 'A'
then
'perform SQL statement to update description field only
where item number starts with A
then perform if to go to next item type and update those
records
'move to the next record to see what the Item Type for
that part is
rst.movenext
loop
What the above is doing though is Updating all the
records, not only the ones where the Item number starts
with A
Any help is appreciated. Thanks in advance.
certain criteria. What I need to do is update a
description field with the appropriate text from other
tables based on the part number field. I have the sql
statement written as I need it but I am having trouble
with how to set the criteria to only update the
appropriate records.
Specifically here is what I need to do.
I have a part number ie. A15PSIBC - each letter/number in
this code represents part of the description - i.e A is
Aluminum, 15 is the size, P is a labour type, etc. I have
all the tables set up to 'build' the description for this
part number and I have the SQL statement (in VB) to
update the parts table with the description - that part
is working fine. Where I am running into trouble is I
need the description built based on different tables
based on the Item Type (the first letter of the Part
number)
What I thought would work is to open the item table as a
recordset (table I need to update).
Do while not rst.eof
'get first letter from Item no to set Item Type
sItemType = Left(ItemMaster!ItemNo, 1)
if sItemType = 'A'
then
'perform SQL statement to update description field only
where item number starts with A
then perform if to go to next item type and update those
records
'move to the next record to see what the Item Type for
that part is
rst.movenext
loop
What the above is doing though is Updating all the
records, not only the ones where the Item number starts
with A
Any help is appreciated. Thanks in advance.