473,411 Members | 2,184 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

Numbering Continuous Forms with Labels

As it stands right now I have a form with a sub form within it. This sub form is a continuous form that I want to have numbered i.e. Element 1, Element 2 ... and so on. I can implement this with Two labels one for "Element " part and one for the number. I've tried several different ways all of which proved little. Is there anyway that I can do this?
Nov 16 '07 #1
1 1929
FishVal
2,653 Expert 2GB
Hi, there.

Well, it requires some definite table design - the table on "many" side of relationship has to have AutoNumber field.


Below is working example.


Tables:

tblMaster
keyMasterID Autonumber(Long), PK
......

tblChild
keyChildID Autonumber(Long, Increment), PK
keyMasterID FK(tblMaster)
.........


Code module:

Expand|Select|Wrap|Line Numbers
  1. Public Function EnumRecords(varPK As Variant, varFK As Variant) As Variant
  2.  
  3.     'declares variable which content will be preserved between calls
  4.     Static lngCounter As Long
  5.  
  6.     If IsNull(varPK) Or IsNull(varFK) Then Exit Function
  7.  
  8.     'reset counter if the value of tblChild.keyChildID
  9.     ' is the minimum for given tblChild.keyMasterID
  10.     If DMin("keyChildID", "tblChild", "keyMasterID=" & varFK) = varPK Then _
  11.         lngCounter = 0
  12.  
  13.     lngCounter = lngCounter + 1
  14.     EnumRecords = lngCounter
  15.  
  16. End Function
  17.  

Queries:

qryChild
Expand|Select|Wrap|Line Numbers
  1. SELECT tblChild.keyChildID, tblChild.keyMasterID, tblChild.txtChild, "Element " & EnumRecords(tblChild.keyChildID,tblChild.keyMasterID) AS txtElNo
  2. FROM tblChild;
  3.  

Forms:

frmMaster
RecordSource: tblMaster
Controls: frmChild as subform

frmChild
RecordSource: qryChild
Controls: txtElNo as TextBox - > ControlSource: qryChild.txtElNo


Regards,
Fish
Nov 17 '07 #2

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

Similar topics

2
by: aaj | last post by:
Hi all I have a small but rather annoying problem with continuos forms, and am wondering if anyone can suggest a method of getting over it. The front end is Access 2002 with the BE being SQL...
1
by: Vladimir Koudela | last post by:
Hi people, I am sure most of you have already solved the Access' stupid problem: there is no simple way of numbring of records shown in a continuous form, needed so often (top-lists, achieved...
1
by: Sabine Oebbecke | last post by:
Hi there, Need some help again ... I have a continuous form which shows the attendees of a competition as per their placing in the competition. So, the first record is the winner, the second...
3
by: Richard Hollenbeck | last post by:
I have the following query in my form's code: Private Function Get_Data(fieldNum As Integer) Dim strSQL As String Dim db As DAO.Database Dim rs As DAO.Recordset strSQL = "SELECT & "", "" & ...
3
by: joelpollock | last post by:
I'm having trouble continuously page numbering a large report in MS Access. The report is made up of three separate Access reports which I join together at the end. In the past I have opened the...
3
by: trgpham | last post by:
Hi all, I have a question and really hoping you guys can help or point me to the right direction. MY SCENARIO: I need to design a screen which show up all the questionnaires and the users can...
1
by: blueheelers | last post by:
I have been researching for several hours on the best way to display images in continous forms in Access 2003. For example, I want to display employee name, email, phone, and picture for each...
0
by: Lauren Quantrell | last post by:
I've seen a lot of posts asking how to get Datasheet-like functionality into a Continuous Form. One of the obvious missing elements is adjustable column widths. I had the same need so I created...
0
by: ARC | last post by:
Hello all, What's the secret for continuous reports in access, such as continuous feed labels or receipt printer paper? I'm unsure how access works with the top / bottom margins, and the page...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
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...

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.