473,394 Members | 1,755 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,394 software developers and data experts.

Subforms & Counting

Hi all,
I have 2 tables in a one to many relationship.
The first table is customer's info.
Second table is customer's assets.
I have an autonumber field in the customer's table
which I use for a customer ID number, and it's the
primary key. The Child key in the assets table
is a number field.

The first table (customers), is used on a main form with
the data from the second table (assets), as a subform.

Now, I also need an "autonumber" field in the assets
table that counts the assets for each particular customer
as I enter them into the assets table via the subform.
If I simply insert an autonumber field into the assets table,
I get an ongoing count for all assets of all customers.

Thanks for any help,

Mark


Nov 12 '05 #1
4 1481
see: DCount(Expr, Domain, Criteria)

John Bickmore
www.BicycleCam.com
www.Feed-Zone.com

"MARK TURNER" <tu********@verizon.net> wrote in message
news:y_******************@nwrddc02.gnilink.net...
Hi all,
I have 2 tables in a one to many relationship.
The first table is customer's info.
Second table is customer's assets.
I have an autonumber field in the customer's table
which I use for a customer ID number, and it's the
primary key. The Child key in the assets table
is a number field.

The first table (customers), is used on a main form with
the data from the second table (assets), as a subform.

Now, I also need an "autonumber" field in the assets
table that counts the assets for each particular customer
as I enter them into the assets table via the subform.
If I simply insert an autonumber field into the assets table,
I get an ongoing count for all assets of all customers.

Thanks for any help,

Mark

Nov 12 '05 #2
Hi,
I worked with the DCount function. I don't think it's going to provide me
with what I was looking for. More than likely a lack of skills on this end.
I'm looking for something similar to an autonumber field, except it will
pertain only to the current subdataset. Example: I have a client,
(on a main form), and as I enter data into that client's subform, I would
like to have the item number automatically incremented by a count of one
for each new entry. After I'm done adding elements to the clients subform,
I will
add another client on the main form. I'd like the number field in the
subform to start counting
at 1 again for the new client.
Right now I'm using a regular number field and have to type in the
item number as I go.
Thanks for the information though.

Mark
Nov 12 '05 #3
Have a look here:
http://www.lebans.com/rownumber.htm
Rownumber.zip is a database containing functions for the automatic row
numbering of Forms, SubForms and Queries.

Updated Oct. 13 by Allen Browne. Includes error handling and cleaned
code.
--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
"Mark T." <tu********@verizon.net> wrote in message
news:wC*****************@nwrddc03.gnilink.net...
Hi,
I worked with the DCount function. I don't think it's going to provide me with what I was looking for. More than likely a lack of skills on this end. I'm looking for something similar to an autonumber field, except it will pertain only to the current subdataset. Example: I have a client,
(on a main form), and as I enter data into that client's subform, I would like to have the item number automatically incremented by a count of one for each new entry. After I'm done adding elements to the clients subform, I will
add another client on the main form. I'd like the number field in the
subform to start counting
at 1 again for the new client.
Right now I'm using a regular number field and have to type in the
item number as I go.
Thanks for the information though.

Mark


Nov 12 '05 #4
Thanks Stephen,

I took the module apart. I think I can make it work.

Mark
Nov 12 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Liam Kitson | last post by:
I have a main form which contains one subforms. All of the data is from the same record. The main form contains the personals details and the subform contains their order details. I would like to...
2
by: Josh Felker | last post by:
Hey everyone. I have a daily log form with my investing info. In that form I have 2 subforms, the first shows my profits on all the stocks I traded that day, the second shows my profits on...
0
by: Jack | last post by:
Gday everyone, I'm dearly hoping Stephen Lebans is going to update his masterpeice to stop the mouse wheel scrolling to work on subforms *he has indicated this to me but of course beggers can't...
7
by: sathyashrayan | last post by:
Group, Following function will check weather a bit is set in the given variouble x. int bit_count(long x) { int n = 0; /* ** The loop will execute once for each bit of x set,
4
by: Dado | last post by:
I have a next situation with the textbox field: A - B = C 1. How to fill the A fill with the data from my previous recordset ? Can I do it with the expression builder ? 2. I want that every...
7
by: philelpko | last post by:
Good Morning all, I have a main form with 3 subforms. All of the input data on all the forms is stored in the same table. I started getting the message "the changes you requested to the table...
56
by: Zytan | last post by:
Obviously you can't just use a simple for loop, since you may skip over elements. You could modify the loop counter each time an element is deleted. But, the loop ending condition must be...
3
imrosie
by: imrosie | last post by:
Hello anyone, Is there someone that has a routine to do this? On the Main form I have cmd buttons that clear and undo.. Specifically the Undo doesn't undo the subforms, just the Main form. I...
1
by: hsangi | last post by:
I have a Main Form with a combo box at the top. The combo box has 6 different values it reads from a table. I have 6 subforms which I have already built. Depending on the value selected in the combo...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...

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.