Computer Learning Zone CLZ Access Excel Word Windows

You don't learn to walk by following rules. You learn by doing, and by falling over.

-Richard Branson
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Visitor Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Do While
Joanne Baker 
   
11 months ago
Hello,  I am trying to updated a field on records in a table and I believe I need a do while loop, but am not having success.  The table has dates of a week - 10-12 rows for each date Sun - Sat.  While still on one date, I would like to update a field on each record with 1 - 10 or 12 or until the next date changes.  Thank you for any help you can provide.  Joanne
Adam Schwanz  @Reply  
           
11 months ago
So what do you have now that isn't working?

Do While Loop

Loop should work fine, personally I'd use a recordset probably though. Recordsets
Joanne Baker OP  @Reply  
   
11 months ago
Thank you for responding Adam.  I will study recordsets before trying Do While again.  I do some minor development but may have taken on more than I am capable of with this project for my son.  So for now I pick and choose topics when I hit a snag.  I'm almost 80 and don't want to become an expert developer, although I love Richard's classes.  Thank you again for your assistance, Adam.  I wish you success and enjoyment in all you do.  Joanne
Sami Shamma  @Reply  
             
11 months ago
Recordset is definitely the way to go.
Joanne Baker OP  @Reply  
   
11 months ago

Joanne Baker OP  @Reply  
   
11 months ago
Thank you Adam and Sami.  I attached a photo of what I am trying to do and will send a second message with the errors I receive.
Thanks for any help.  
Joanne
Joanne Baker OP  @Reply  
   
11 months ago

Joanne Baker OP  @Reply  
   
11 months ago
These are the error messages - one when I tried using Update / Set and one without that.
As I said I am an amateur with both Access and sql.  Thanks very much for any info as to what I am doing wrong.  
Joanne
Sami Shamma  @Reply  
             
11 months ago
Is ".row" and ".box" part of your field names?

Please share that table in design view.

If you put a dot in a field name, it's going to cause you an enormous amount of pain.
Joanne Baker OP  @Reply  
   
11 months ago

Joanne Baker OP  @Reply  
   
11 months ago
Thanks Sami - yes, Row and Box are fields on the T9b_select_WOs table.  Row is already populated.  I am trying to populate Box from 1 to xx until Row changes.  Thanks for looking at this.
Joanne
Joanne Baker OP  @Reply  
   
11 months ago
I should mention there is no dot in the field name ..  just Table.field   thanks
Sami Shamma  @Reply  
             
11 months ago
You have already opened a record set for this table. The line that is giving you error should read:

If rs!Row = Next_Row Then
Joanne Baker OP  @Reply  
   
11 months ago

Joanne Baker OP  @Reply  
   
11 months ago
Thank you Sami for getting me past that error!  I looked up some logic for recordset edit/update and was able to run this code.
My logic is not quite right (results in next photo), but I can work on that.

Thank you so much!!  Adam also!
Joanne
Joanne Baker OP  @Reply  
   
11 months ago

Joanne Baker OP  @Reply  
   
11 months ago
I'll work on the lotic to get the Box numbers sequential now.
Again, I am very grateful for your help!
Joanne
Sami Shamma  @Reply  
             
11 months ago
Joanne Can you write in English what you expect the code to do?
Joanne Baker OP  @Reply  
   
11 months ago
You are kind to look further.  I should be able to adjust the code to account for the first record, then count up with the boxes.  But since you asked - hopefully this is clear.  Many thanks again, Sami!
     The table is sorted by row - there will be from 1 to 10 records with Row = 1, then 1-to ten records with Row = 2, etc.
like so the first 15 records could have row numbers like this:  1,1,1,1,2,2,2,3,4,4,4,4,4,4,4,4  etc.  
      At the start, the first record will have Row = 1.  I want the boxes for all records with Row 1 to count up - 1,2,3,4, etc.
    Then when row 2 starts, I want the box numbers to start from 1 again for all the records with row 2.
First 15 records:  
Row   Box
1       1
1       2
1       3
1       4
2       1
2       2
2       3
3       1
4       1
4       2,  etc  Thanks again Sami!  Have a nice rest of the week.  Joanne

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Visitor Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/6/2026 7:40:04 AM. PLT: 0s