Microsoft Access Forums

Go Back   Microsoft Access Forums > Access Forums > Programming

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 07-02-2009, 04:04 PM
orion orion is offline Windows XP Access 2007 (version 12.0)
Novice
 
Join Date: Jun 2009
Posts: 10
orion is on a distinguished road
Default Help with Sequential Numbering

I have a two tables called “tblProject” and “tblSample” related by “Project_No” field (one to many) as shown below. Each Project has Many Samples.

tblProject
Project_No Project_Name
P060801 A
P060802 B

tblSample
Sample_ID Project_No Sample_No Sample_Code
1 P060801 01 P060801-01
2 P060801 02 P060801-02
3 P060802 01 P060802-01
4 P060802 02 P060802-02
5 P060802 03 P060802-03

I also have “frmProject” which is the main form and “frmsample” which is the subform.

Each time I add a new sample relating to a particular project and click on the “Save” button on the form “Sample”, I want to generate a sequence of numbers for that particular project. The sample number should restart for a new project selected.

I need help with writing the code for generating sequence of sample numbers for the “Sample_No” field based on the project I select.

As shown in the table above I can concatenate to display that way I want it to later for the “Sample_Code” field. I have about 3 weeks experience with access and know very little coding let alone using conditions. (I think I need to use “Dmax” and maybe some if statements but have no clue as to how)

I would really appreciate it if I could get help with the coding or at least how to go about it.

Thank you very much for you time!
Reply With Quote
  #2  
Old 07-02-2009, 07:43 PM
RuralGuy's Avatar
RuralGuy RuralGuy is online now Windows 7 Access 2007 (version 12.0)
Administrator
 
Join Date: Mar 2007
Location: 8300' in the Colorado Rocky Mountains
Posts: 4,263
RuralGuy will become famous soon enoughRuralGuy will become famous soon enough
Default

The first sample db on this link should help.
__________________
(RG for short) aka Allan Bunch MS Access MVP - WinXP Pro, Win7 - acXP, ac07
If your issue is resolved...follow this link for directions on how to use the Solved thread tool!
Teaching is not filling a bucket but lighting a fire. Borrowed quote..."Docendo discimus"
Reply With Quote
  #3  
Old 07-06-2009, 11:21 AM
orion orion is offline Windows XP Access 2007 (version 12.0)
Novice
 
Join Date: Jun 2009
Posts: 10
orion is on a distinguished road
Default

Thank you much RuralGuy, that was perfect!!!
Reply With Quote
  #4  
Old 07-06-2009, 11:41 AM
RuralGuy's Avatar
RuralGuy RuralGuy is online now Windows 7 Access 2007 (version 12.0)
Administrator
 
Join Date: Mar 2007
Location: 8300' in the Colorado Rocky Mountains
Posts: 4,263
RuralGuy will become famous soon enoughRuralGuy will become famous soon enough
Default

You're welcome. We must be ready for the Solved thread now, right?
__________________
(RG for short) aka Allan Bunch MS Access MVP - WinXP Pro, Win7 - acXP, ac07
If your issue is resolved...follow this link for directions on how to use the Solved thread tool!
Teaching is not filling a bucket but lighting a fire. Borrowed quote..."Docendo discimus"
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Assign A Sequential Number To A Table Row KramerJ Programming 11 04-08-2009 06:48 AM
create sequential id proudestmnky1 Programming 0 12-15-2008 09:10 PM
Numbering records knightjp Database Design 0 08-17-2008 05:07 AM
Auto Numbering rkruczk Forms 0 10-09-2006 02:25 AM
Page numbering glitch kfinpgh Reports 3 08-17-2006 06:23 PM


All times are GMT -8. The time now is 02:40 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.