A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Update from other fields



 
 
Thread Tools Display Modes
  #1  
Old July 11th, 2008, 04:40 PM posted to microsoft.public.access.queries
Student Databaser
external usenet poster
 
Posts: 29
Default Update from other fields

I want to populate the Trainer_ID field with 00+First three letters of field
first name +first three letters of field last name where Trainer_ID is Null

I think this would be similar to

UPDATE [Master Trainers] SET [Master Trainers].TRAINER_ID ="00"+((left(First
Name),3))+((left(Last Name),3))
WHERE ((([Master Trainers].TRAINER_ID) Is Null));

suggestions please Thanks



  #2  
Old July 11th, 2008, 05:04 PM posted to microsoft.public.access.queries
John Spencer
external usenet poster
 
Posts: 7,815
Default Update from other fields

The only thing I see that might be amiss is that your field names have spaces
so they must include square brackets around them

STEP 1: BACKUP your data before attempting the following.
STEP 2: BACKUP your data before attempting the following.

Without a backup you cannot restore the data if this does not work the way you
expect.

UPDATE [Master Trainers]
SET [Master Trainers].TRAINER_ID =
"00" + LEFT([First Name],3) + LEFT([Last Name],3)
WHERE [Master Trainers].TRAINER_ID Is Null

One other problem is that you may get results like
OOJoOh if your trainer's first name is Jo and her last name is Oh.



John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County

Student Databaser wrote:
I want to populate the Trainer_ID field with 00+First three letters of field
first name +first three letters of field last name where Trainer_ID is Null

I think this would be similar to

UPDATE [Master Trainers] SET [Master Trainers].TRAINER_ID ="00"+((left(First
Name),3))+((left(Last Name),3))
WHERE ((([Master Trainers].TRAINER_ID) Is Null));

suggestions please Thanks



  #3  
Old July 11th, 2008, 05:07 PM posted to microsoft.public.access.queries
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default Update from other fields

Did you try it? Why not?

Always backup your database before doing any global update ---
UPDATE [Master Trainers] SET [Master Trainers].[TRAINER_ID] ="00" &
left([First Name],3) & left([Last Name],3)
WHERE [Master Trainers].[TRAINER_ID] Is Null;

--
KARL DEWEY
Build a little - Test a little


"Student Databaser" wrote:

I want to populate the Trainer_ID field with 00+First three letters of field
first name +first three letters of field last name where Trainer_ID is Null

I think this would be similar to

UPDATE [Master Trainers] SET [Master Trainers].TRAINER_ID ="00"+((left(First
Name),3))+((left(Last Name),3))
WHERE ((([Master Trainers].TRAINER_ID) Is Null));

suggestions please Thanks



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 11:23 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.