473,326 Members | 2,813 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,326 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 2751
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Lumpierbritches | last post by:
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...
0
by: JJ | last post by:
Hi All, I am trying to Add nodes in code behind and am having problems with the parent child relationships. I get a Use of unassigned local variable error . I have the local variables defined...
3
by: Darryn Ross | last post by:
Hi, How do i get my datagrid to display the contents of two related tables setup in my access database, so i can see the plus/minus sign to expand retract the Child details? Regards Darryn
4
by: Danny Tuppeny | last post by:
Hi all, I've been trying to write some classes, so when I have a parent-child relationship, such as with Folders in my application, I don't have to remember to add a parent reference, as well as...
1
by: Mr Newbie | last post by:
Sorry to bother you guys but I have another questions related to DataSets. I'm almost there now, so I dont expect to bug you much more ( Hopefully ). I have Master / Details tables with...
2
by: mkidd | last post by:
Hi, I'm new at vb .net and I have an issue that must be a common one, but I haven't found an example of it yet. I want to create parent-child relationships for 3 tables...
0
by: Mr Newbie | last post by:
Sorry to bother you guys but I have another questions related to DataSets. I'm almost there now, so I dont expect to bug you much more ( Hopefully ). I have Master / Details tables with...
3
by: RobKinney1 | last post by:
Hello, Thank you for reading this post. Please forgive my ignorance. This may be a simple question but am having trouble finding a straight answer. I need pass data from my Child Window back...
3
by: reachsamdurai | last post by:
Is it possible to determine the list of child/parent tables for a particular table from any system catalog tables? Using the syscat.tables I'm able to retrieve the no of dependent parent/child...
8
by: Rick | last post by:
VS 2005 I' m setting up a parent/child datagridviews in a form. I am doing a lot of this by hand coding in order to get the feel of things. I want a change in the parent table to trigger a...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.