Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Combine two rows into one
Mauricio Bick 
     
3 years ago
I'm trying to figure out a way to combine two rows into one but only certain columns.  I have csv timecard file that I import into my DB.  The file only captures ins and outs but on a different row. So start time and out to lunch goes in one row and back from lunch and out for the day is another row.  I'm trying to figure out a way to put the ins and outs in the same row for that day per employee.
Mauricio Bick OP  @Reply  
     
3 years ago

Kevin Yip  @Reply  
     
3 years ago
If you want to show everything in one row for display purposes on a report or form, there are ways to do it.  But regarding the actual table design for your data, it is in fact a sound design to show the same person in multiple rows, since those rows depict multiple events, and that is what rows are for.  This is how you set up the "many" side in a one-to-many relationship.  Table design is the foundation your database and it must be sound.

To put 2 rows into one row in your example, you need to use VBA to read the two rows' data with a Recordset loop, save their values into some kind of variables, and show their values on your form or report.  But the form or report can only be so wide.  What if a person logs in and out 5 times a day, 10 times a day?  You will have way more columns than you can fit on the screen.
Mauricio Bick OP  @Reply  
     
3 years ago
@ Kevin Yip thank you for replying.  By any chance do have an example that you can share with me?  I would really appreciate it.

Thank you.
Kevin Yip  @Reply  
     
3 years ago
The pictures below show an example I did a while ago.  I have a table with several rows:

Lot     Units
1     10
2     20
3     30
...

And all the info is turned into one row:

Lot 1 (10 units), Lot 2 (20 units), Lot 3 (30 units)

Some VBA is needed to create a custom function to combine different rows together.

Again, this method is only for displaying purpose.  Data can be displayed in many ways, but they must be stored in a structured, "normalized" manner in tables.  That usually means tables can't be modified to have rows combined together.
Kevin Yip  @Reply  
     
3 years ago

Mauricio Bick OP  @Reply  
     
3 years ago
I will give it a try.

Thank you for sharing.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access 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 12:36:20 PM. PLT: 0s