Use an update query and offset records

K

kr

i have a table of records. I want to assign every other record to a list of
employees. How can i use an update query to update a "EmpNm" field and offset
for every individual employee.? How would I get it to offset and do
automatically for the set #'d of records?
Thank you.
 
J

John W. Vinson

i have a table of records. I want to assign every other record to a list of
employees. How can i use an update query to update a "EmpNm" field and offset
for every individual employee.? How would I get it to offset and do
automatically for the set #'d of records?
Thank you.

This question assumes that tables have record numbers, and that the phrase
"every other record" is meaningful. Neither assumption is correct. A table has
no usable order; it should be viewed as an unordered "heap" of records.

It's also not at all clear what you mean by "offset". I presume you have a
table of Employees, and another table? What is the structure of this other
table? Could you post a few rows of sample data and the desired result?
 
K

kr

yeah,
I have records of customers. i have a list of employees. i would like to
assign each record to one employee. So, if i have 9 records, employee A, B, C
will receive 3 records each. but in the update query - i would like to update
a the "Employee" field with their names but ever other record
A - REcord 1
B - REc 2
C - Rec 3
A - REc 4

ect.
 
J

John W. Vinson

yeah,
I have records of customers. i have a list of employees. i would like to
assign each record to one employee. So, if i have 9 records, employee A, B, C
will receive 3 records each. but in the update query - i would like to update
a the "Employee" field with their names but ever other record
A - REcord 1
B - REc 2
C - Rec 3
A - REc 4

I suspect you'll need to do this by opening a Recordset in VBA code and
stepping through it.

You have chosen to not post any information about the structure of fields of
your table, so obviously I cannot suggest specific code or a query.
 
K

kr

i'm sorry about that. i looked - how do i post a table?
also, someone answered the question before but i can't find the answer. i
believe he used the mod function to return the number of rows and then
something else. but i can't seem to find it.
 
P

Piet Linden

i'm sorry about that. i looked - how do i post a table?
also, someone answered the question before but i can't find the answer. i
believe he used the mod function to return the number of rows and then
something else. but i can't seem to find it.

post the field types/sizes/primary and foreign keys.
 
J

John W. Vinson

i'm sorry about that. i looked - how do i post a table?

Manually:

Tablename
Field1name (Autonumber, Primary Key)
Field2name (text)
Field3name (date/time)

If the purpose of the field isn't obvious from the fieldname please include a
brief explanation.
 
K

kr

Rep (Text)
Date (Date/Time)
Contact Name (Text)
Contact Address (Text)
Contact Phone# (Text)

I have a list of employees in another table:
Table 2
Rep Names (Text)
Ralph
Lynn
Dorian

I have x amount of records in Table 1. I would like to update the Rep field
in Table 1 with the names from Table 2 - each rep be assigned 1 record
alternately. So if there are 9 records - then Ralph will get 3, Lynn 3 and
Dorian 3. (Some times there are not an even amount of records.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top