469,610 Members | 1,768 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,610 developers. It's quick & easy.

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 2505
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 devrayhaan | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.