update records

  • Thread starter Thread starter Mjohnson
  • Start date Start date
M

Mjohnson

Say I have a table (with lots of records) and I need to
assign A, B, C, and D to a record going all the way down
the file, what is the easiest way to do it. I don't know
if I said it right in words, but see below for further
descriptions:





My table now:



Record 1

Record 2

Record 3

Record 4

Record 5

Record 6

Record 7

Record 8

Record 9





I want to update it to say



Record 1 A

Record 2 B

Record 3 C

Record 4 D

Record 5 A

Record 6 B

Record 7 C

Record 8 D

Record 9 A



And so on all the way down.



What would be the easiest way to do this?



Thanks so much!!!!
 
If you have a field in the database that actually shows
the record number (I'll call it RecNum), then:

1. Add a new column (Letter) to your table structure
2. Create an update query and Update the letter column
using the following function:

Chr$(64 + [RecNum] MOD 4)

The actual SQL would look like:

UPDATE yourTable
SET Letter = chr$(64 + [RecNum] Mod 4)
FROM your Table

HTH
Dale
 
What if I don't have SQL- is there another way????
-----Original Message-----
If you have a field in the database that actually shows
the record number (I'll call it RecNum), then:

1. Add a new column (Letter) to your table structure
2. Create an update query and Update the letter column
using the following function:

Chr$(64 + [RecNum] MOD 4)

The actual SQL would look like:

UPDATE yourTable
SET Letter = chr$(64 + [RecNum] Mod 4)
FROM your Table

HTH
Dale
-----Original Message-----
Say I have a table (with lots of records) and I need to
assign A, B, C, and D to a record going all the way down
the file, what is the easiest way to do it. I don't know
if I said it right in words, but see below for further
descriptions:





My table now:



Record 1

Record 2

Record 3

Record 4

Record 5

Record 6

Record 7

Record 8

Record 9





I want to update it to say



Record 1 A

Record 2 B

Record 3 C

Record 4 D

Record 5 A

Record 6 B

Record 7 C

Record 8 D

Record 9 A



And so on all the way down.



What would be the easiest way to do this?



Thanks so much!!!!




.
.
 
What if I don't have SQL- is there another way????

If you have Access you *DO* have SQL - just open your Query design
window and select View... SQL.

SQL is the language in which all queries are written; the query design
grid is just a tool to help you create SQL. Since it's easy to post
SQL code to newsgroup messages, but difficult to post a readable query
grid, it's typical for folks to post (and request) SQL when discussing
queries.
 
Back
Top