473,804 Members | 3,762 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Loop to update records

1 New Member
HI,

I have two tables WORK and EMP.
Table work has fields - CaseNo,Date_Act , Handler.
Table Emp has one field - EmpName.

My field handler should be populated automatically from my table EMP.

Let us assume there are 100 records in work and 11 records in emp,
I need a query / Macro so that 100 Cases is distributed equally among 11 emp.
The challenge here is that my count of records for both the tables varies daily.

Please Help.
May 1 '10 #1
2 1627
NeoPa
32,579 Recognized Expert Moderator MVP
So what have you tried so far? We don't simply provide solutions here. We help where you get stuck. That generally means you have to have attempted to build a solution.

I can tell you that a query is unlikely to be your best direction to pursue. I would expect this to be implemented via VBA coding.
May 2 '10 #2
robjens
37 New Member
It won't be a problem to spread them evenly if you take for granted that new employees will have less cases assigned. You don't want them to get a burnout on the first week/month so it also comes in handy.

I think you would do with a 1 time full recordset loop, outer one being all the empty "WORK" handler fields, the the inner one all the employees who increment with +1 and rs.movefirst when their loop is done untill all handles are filled. It's there where you also need to expand loops or set criteria depending on your business logic (like max. nr of handles per person, how long cases can be open, etc)
May 2 '10 #3

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

Similar topics

3
2490
by: John Pastrovick | last post by:
I use a function, myrandomPIN (), to generate random PIN numbers. The following sql query updates records with the SAME PIN number but. I want to generate DIFFERENT pin numbers for every record. The function is ok but I can't figure out how to run it individually for each record. In other words I do not know the correct syntax to use UPDATE in a loop (if necessary) so that a different call to the function is done every time or ecah...
2
1885
by: Sporke13 | last post by:
I have used stored procedures to insert and select but for some reason I can not get this code to update records. Please help I must have made a dumb mistake STORED PROCEDURE CREATE Procedure OrdersAddDetail ( @fname nvarchar(50), @lnametxt nvarchar(50), @add1 nvarchar(50), @add2 nvarchar(50),
8
11244
by: RC | last post by:
In my Access 2002 form, I have a combo box and on the AfterUpdate event I use DoCmd.RunSQL ("UPDATE .... to update records in a table. When it starts to run I get a message "You are about to update 3 row(s)." Is there a way to prevent the message from popping up?
8
1616
by: mantrid | last post by:
Hello Im having problems working out why the following code does not work. I dont think its the sql as the error occurs on the first update which ever one is put there ($q1 or $q2). Ive swapped then around to test this. Help greatly appreciated The error is Unknown column 'A' in 'field list' but there is no field 'A'. im thinking that the 'A' may be first letter of the word Array, as if it is using this as a variable, but i dont know...
5
2200
bhcob1
by: bhcob1 | last post by:
Hey Guys, I have a db, with a table tblCSOC, there are 4 fields that are releveatn to my question: tblCSOC - primary key - primary key - checkbox - autonumber The autonumber key was created so i could uniuqly identify each record.
3
6161
by: ebru | last post by:
about insert/delete/update records in mysql server with asp code how can I insert record in mysql database.. I insert into database but if I leave one text box empty, its give me error how can overcome on it... my code is like "INSERT INTO hamp6 VALUES ('" & request.QueryString("FRAME_WORK_ARRANGEMENT_REF_NUM")& "', '" & request.QueryString("TASK_ORDER_FORM_REFERENCE_NUMBER") &"', '" & request.QueryString ("TASK_TITLE") &"', '" &...
3
20160
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 work on the sql server side, and not have to change the db2 side as that takes some time from our developers. But this is what i want to do. I have a stored procedure that calls the db2 stored procedure to return 4 leave amounts(@Annual, @Sick,...
7
2892
by: emajka21 | last post by:
I have been working on creating a HR database. Everything is working fine there but now they want a training database. I basically need a few fields from the employee table and I need the full department table. I also need the position titles table along with 1 additional field. I was able to export everything fine to the new database. Is there a way to update the training database when data is updated in the HR database. I figured out...
3
1211
misscrf
by: misscrf | last post by:
I have put this code together (from various posts on the web and the help file...) It loops through a folder of CSVs and imports them into a table, updating a column with the file name. What I am stuck with is that it asks me Yes or No do I want to update the records for the update part. Anyway I can get it to just answer yes? Private Sub Command0_Click() Dim strDocPath As String Dim strCurrentFile As String strDocPath =...
7
7635
by: ndhvu | last post by:
Tables: Buy_Header and Buy_Detail. - Buy_Header: info. of each buy (buy_id(PK, auto number), date, shop, bought_by, ...) - Buy_Detail: info. of each item from each buy (buy_detail_id(PK, auto number), buy_id, item_name, price, quantity,...) Target: - Make a main-form of table with sub-form of table to insert/update records for both tables. Each form of each and the sub-form can have many records of . - When update, you can add more...
0
9579
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10571
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10326
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10317
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10075
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6851
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5520
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3815
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.