Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Update or Append Data to a New Field in the Same Table

Posted on 2013-01-17
12
Medium Priority
?
433 Views
Last Modified: 2013-01-17
Hi Experts -

I'm trying to update a field in a table with the correct view; that is to show all Part Numbers in one field. If you look at my sample2 database; I have a field called PartNumber and one called PartNumber2 I would like both of these numbers in the same field named NewPartNumber in the same table.

Should I use an Update or Append query for this?

Thanks in Advance,
GeneBat
sample2.mdb
0
Comment
Question by:GeneBat
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
12 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 38788524
use an update query

update tablename
set [NewPartNumber]=[partnumber1] & [partnumber2]

how exactly do you want to show the newPartnumber?
0
 

Author Comment

by:GeneBat
ID: 38788594
Cap -
I forgot to write this; I don't want the RBB_Vendor text in the new field just numbers only.
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 38788609
post sample result..
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:GeneBat
ID: 38788645
here's a sample result. if you run the update query it put's everything in the field and not just the numbers only.
sample2.mdb
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 38788658
try this query

UPDATE sample SET sample.NewPartNumber =IIF(isnumeric([PartNumber]),[PartNumber] & [PartNumber2],[PartNumber2])
0
 

Author Comment

by:GeneBat
ID: 38788756
Darn, the real data could have a alpha and numeric in the PartNumber and PartNumber2 field see sample2.

Sorry about this Cap1?
sample2.mdb
0
 
LVL 31

Expert Comment

by:Helen Feddema
ID: 38788761
Generally, it is better to do this kind of thing in a query, because if you write the concatenated value to a field in a table, and one of the components changes, the concatenated value will be incorrect.
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 38788784
<Darn, the real data could have a alpha and numeric in the PartNumber and PartNumber2 field see sample2. >

so, what do you want to happen,  don't make me keep guessing

state the rules that need to be followed... in plain english

post sample values  and the result you want
0
 

Author Comment

by:GeneBat
ID: 38788798
Hi Helen_Feddema -

Thanks; I'm trying to get the query correct as in the same database I have attached.
0
 

Author Comment

by:GeneBat
ID: 38788841
What we're doing is correct it's just the the database field PartNumber could have a number that looks like this 13J13 so; isnumeric would not work.

PartNumber          PartNumber2     NewPartNumber
13J13                                                13J13
RRB_Vendor           14R14                 14R14
15T15                                                15T15

Like the example above.
Thanks in advance.
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 2000 total points
ID: 38788877
so basically we will disregard the values "RBB_Vendor" from PartNumber



UPDATE sample SET sample.NewPartNumber = IIF([PartNumber] Not Like "RBB_Vendor",[PartNumber] & [PartNumber2],[PartNumber2]);


are there any other values aside from "RBB_Vendor" that must be disregarded?
0
 

Author Closing Comment

by:GeneBat
ID: 38788929
No there aren't...
Wonderful!
It works great!
Thanks so much Cap1.
0

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question