472,143 Members | 1,597 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Loops for Parent/Child relationships

Thank you in advance for all your assistance, it is GREATLY appreciated. I'm
writing a small Access 2000 program for tracking Kennel Litters for a friend
and I'm wondering how I can loop through all records from a Parent form to the
Child form with a matching Parent Child relationship.

What I'm trying to do is make it where she can check a box or hit a command
button, loop through all the child records with the same ParentID as the
foreign ChildID and update Date, Procedure and other various information.

Example: Shot for one dog, will be same for all the dogs in that litter.
Instead of having to enter each shot individually, a checkbox or command button
could be used to enter all similar shots/procedures for the complete litter?

Michael
Nov 12 '05 #1
3 2649
Lumpierbritches wrote:
Thank you in advance for all your assistance, it is GREATLY appreciated. I'm
writing a small Access 2000 program for tracking Kennel Litters for a friend
and I'm wondering how I can loop through all records from a Parent form to the
Child form with a matching Parent Child relationship.

What I'm trying to do is make it where she can check a box or hit a command
button, loop through all the child records with the same ParentID as the
foreign ChildID and update Date, Procedure and other various information.

Example: Shot for one dog, will be same for all the dogs in that litter.
Instead of having to enter each shot individually, a checkbox or command button
could be used to enter all similar shots/procedures for the complete litter?

Michael


For 'loop through all records' which is a procedural expression,
relational databases use update statements (queries, in Access).

You can create a query that updates a field in every record conforming
to certain criteria. I don't know what a litter is, but if you have an
expression for one litter, you can put that in the criteria row with the
update query.

Play with it, maybe you get the hang of it.

--
Bas Cost Budde
http://www.heuveltop.org/BasCB
but the domain is nl

Nov 12 '05 #2
Lumpierbritches wrote:
Thank you in advance for all your assistance, it is GREATLY appreciated. I'm
writing a small Access 2000 program for tracking Kennel Litters for a friend
and I'm wondering how I can loop through all records from a Parent form to the
Child form with a matching Parent Child relationship.

What I'm trying to do is make it where she can check a box or hit a command
button, loop through all the child records with the same ParentID as the
foreign ChildID and update Date, Procedure and other various information.

Example: Shot for one dog, will be same for all the dogs in that litter.
Instead of having to enter each shot individually, a checkbox or command button
could be used to enter all similar shots/procedures for the complete litter?

Michael

Dim db as database
Dim SQLString as string

Set db=CurrentDB
SQLString = "UPDATE ChildRecord SET ChildRecord.ShotDate = #" &
Me!DateOfShot & #"
SQLString = SQLString & " WHERE ChildRecord.ParentID= " & Me!ParentID & ";"
DB.Execute SQLString

This is air code.

Ron

--
Ronald W. Roberts
Roberts Communication
rw*******************@robcom.com
To reply remove "_at_robcom_dot_com"

Nov 12 '05 #3
Will you always perform the same procedure on all members of the litter? For
some procedures I would agree but for others it may be just a few of the
litter.

I would suggest an approach that would allow you to update one, more than one
or all child records with the same procedures by selecting child records. You
could provide the means to select all records by using a command button for the
list of child records or select each record that needs to be updated. Then
process only the records that were "selected" for processing.

Bill
Nov 12 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Lumpierbritches | last post: by
reply views Thread by JJ | last post: by
3 posts views Thread by Darryn Ross | last post: by
4 posts views Thread by Danny Tuppeny | last post: by
reply views Thread by Mr Newbie | last post: by
3 posts views Thread by RobKinney1 | last post: by
3 posts views Thread by reachsamdurai | last post: by
8 posts views Thread by Rick | last post: by
reply views Thread by leo001 | last post: by

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.