473,386 Members | 1,715 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How do I update all records in table 1 by looping through table 2?

16
My application is to re-assign leads to different groups of salespeople by sequentially assigning them to each salesperson. I've got an Access 2000 front end to an MS-SQL database.

Currently, I do this effectively (but sloppily and slowly) by exporting Access records to Excel, doing my assignments there, importing back into a new work table in Access, and running an update query (joining on Lead.ID). However, I'm soon going to exceed the 64K record limitation in Excel. I'd like to accomplish the whole thing more eloquently in Access.

Let's call Table 1 LEADS, and Table 2 SALESPEOPLE.

I need to update the assigned Salesperson in the field LEADS.SP by sequencing through all records in SALESPEOPLE and looping until all selected LEADS are updated.

I used to do this in FoxPro or Dbase by opening the two tables and using syntax including "while not <eof>", "next", and "loop".

Is there a simple way to do this? I don't write VB code nor have I ever created Access Modules (though I can frequently look at existing code and modify it).

Thanks in advance for anyone's help!
Feb 2 '07 #1
3 3639
NeoPa
32,556 Expert Mod 16PB
You don't say, and I can't work out from going through the question, what you want to assign to the field LEADS.SP.
Is it a single salesperson to every lead in the table? Is it some sort of random balancing algorithm?
Feb 2 '07 #2
DWolff
16
Sorry it's been so long for me to notice your reply. . . .

The field Leads.SP is a salesperson name. I want to sequentially select each salesperson from the TABLE Salespeople, assigning the first record to the first lead, second record to the second lead, etc. When I finish sequencing through all the records in the TABLE Salespeople, it should start again from record 1 and continue sequencing until all leads are assigned.
Nov 26 '07 #3
NeoPa
32,556 Expert Mod 16PB
You will probably struggle if you don't like coding :(
What you need (I'm a SQL man mainly but can't see a way of doing this in SQL I'm afraid) is to process through the two recordsets (SALESPEOPLE & LEADS) and assign one each as you go through.
I don't know where your assignments are made (they should be in a separate table).
An example of some basic recordset processing code can be found in Basic DAO recordset loop using two recordsets.
I hope this helps.
Nov 26 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Roy Adams | last post by:
Hi posting again because no answer to previous.. tring to loop through a recordset and update a record, thing is it only updates the first record in the table rather than searching through the...
14
by: serge | last post by:
I have a scenario where two tables are in a One-to-Many relationship and I need to move the data from the Many table to the One table so that it becomes a One-to-One relationship. I need to...
10
by: Colleyville Alan | last post by:
I am trying to turn a short and fat (63 columns) table into one that is tall and skinny (7 columns). Basically, I am trying to create a "reverse crosstab" using a looping structure in VBA along...
2
by: Catch_22 | last post by:
Hi, I have a stored procedure that has to extract the child records for particular parent records. The issue is that in some cases I do not want to extract all the child records only a...
3
by: Slower Than You | last post by:
I am trying to write an SQL UPDATE statement for an MSAccess table and am having some problems getting my head around it. Can anyone help? TableName: CustTransactions TransactionKey AutoNumber ...
13
by: Slower Than You | last post by:
Well, I think it's complex anyway -- you might not :) TableDef: CREATE TABLE CustTransactions ( TransactionKey int IDENTITY(1,1) NOT NULL, CustomerID int, AmountSpent float, CustSelected bit...
6
by: Suresh | last post by:
Hi All, I am fetching a dataset from the database under some condition. After this I create a data table. Traverse in the original dataset & add each row to created data table as it is through...
13
by: Terry Olsen | last post by:
I'm using OleDb to connect with an Access Database. I have anywhere from 10 to over 100 records that I need to either INSERT if the PK doesn't exist or UPDATE if the PK does exist, all in a single...
3
by: barmatt80 | last post by:
I finally got my call to a stored procedure on our db2 to work. However i might have to change what the stored procedure does, if I cannot get it to work how we want. Which i would like to make it...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.