Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   Index   Templates   Seminars   TechHelp   Forums   Help   Contact   Join   Order   Logon  
 
Home > Courses > Access > Expert > X08 > < X07 | X09 >
Back to Access Expert 8    Comments List
Upload Images   Link   Email  
Query Ticket Numbers
David Burns 
      
2 years ago
Hello!
My first question &#128522;
I have a query (LuckyNumberQ) that lists individual names and a lucky number. For example:
Jim Kirk 23
Leonard McCoy 17
Jean-Luc Picard 11
I'd like to be able to generate a query/report showing each individual with a number of ticket entries based on their lucky number. For example:
Name     Ticket
Jim Kirk 10001
Jim Kirk 10002
Jim Kirk 10003 .... to
Jim Kirk 10023 (23 entries)
Leonard McCoy 10024
Leonard McCoy 10025... to
Leonard McCoy 10040 (17 entries)
Jean-Luc Picard 10041
Jean-Luc Picard 10042... to
Jean-Luc Picard 10051 (11 entries)

It's fairly easy to export the LuckyNumberQ into Excel and add field etc. but it would be better if Access would do all the necessary.
Is it possible?
Apologies if this question is in the wrong area.
David Burns OP 
      
2 years ago
I'm thinking along the lines of some code that does something like the following:

Let t = 10001 (the first ticket number)
For the first member in LuckyNumberQ (however this is determined)
  Let n = LuckyNumberQ.LuckyNumber
  Let c = 1 (a counter)
    While c <> n Do
       INSERT INTO NewTableT LuckyNumberQ.FirstName, LuckyNumberQ.LastName, t
       Let c = c + 1
       Let t = t + 1
Next Member
Exit routine if no more members

Then have a report based on NewTableT

Presuming the correct code, would the above be a viable solution?
Will future lessons I'm subscribed to cover how I might approach doing this?

Thanks
David Burns OP 
      
2 years ago
I guess this thread would have been better in the Access Forum rather than here in Expert 8.

Anyway, I've now pulled together VBA that does what I want so I have a new table being created with member names and ticket numbers. I'm now tackling a report that will print each member's ticket numbers on separate pages.
David Burns OP 
      
2 years ago
Well, though it is doing what I want, the VBA occasionally has a hiccup/hiccough where an unexpected section of records that would normally appear partway down the new table actually appear at the start of the new table. (I expected that calling the recordset would see the first entry of the interrogated query appear in the first row of the new table but it doesn't always.)
I've also got the report done as well. I eventually used the labels option so three records appear across the page and each member's tickets appear on separate pages. Yay!
I think I'll reward myself with a coffee and digestive lol

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Expert 8.
 

 
 
 

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 2025 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 2/15/2025 3:45:01 PM. PLT: 1s