Ok...there's actually two comments I'm responding to...here's the first:
"Is not working. I have both Queries link by the parent ID. I enter the
criteria under the parents ID and it did not work. Then i enter the one under
the closing date and is asking for a parameter."
--> For this one, maybe the CLOSE event is not the right event, because you
may not be closing the form right after you update the field. Instead, try
putting the query call in the closing date field's AFTER UPDATE property.
Regarding your second comment (the one below), yes, you will need something
in the children's table, so you can flag the record as closed. What we're
doing is running an Update Query that looks up the child's record (based on
the parent's ID number) and marks it as closed (either by passing a closed
date or flagging the record in some other manner you've designed).
I am assuming that you put the closing date in a field in each child's
record to flag it as closed, but it you use a yes/no flag to show the record
is closed, then change the query "Update To" field to TRUE (or whatever value
you use to flag the record closed). Unfortunately, without seeing how you
flag your children's records as closed, I cannot give you the exact format of
what you need.
If you're new to using Update Queries, you can experiment by:
1. Open the form and fill-in the close date
2. Open the query in design mode
3. Click the datasheet view button. The query should display the closing
date (or True, or whatever) without actually updating the tables.
4. Switch back and forth between the views until you're satisfied that the
query is working correctly.
Just be advised that if you run the query from the VBA Call statement (or
double-click the query in the Navigation Pane), it will run the query and
actually update the table.
---cj
Jessica said:
I need the closing date from the parents table to automatica populat in the
childrens table. That way i just have to enter it once. So that means i would
need closind date field in the children's table correct? But i'm not sure
what to use to make it populate from one to another?
:
If you don't have a button to process the record, try putting the code in the
form's CLOSE event so it runs whenever the form is closed.
(BTW - There's other ways to do this by building SQL strings in VBA, but
this is the easiest way I can think of.)
---cj
:
Yes i have the close date under the parents info in a form and them a
subform with all their children's information.
:
Sorry, but I have to make the assumption that you are entering this close
date on some kind of form, instead of directly in a table; and that they have
to press a button to process the transaction (or close the form):
Create an update query with the [Parent's ID] and [closing date].
Remove the "show" check from the Parent's ID field, and under "Criteria",
enter =Forms![formname]![Parents ID fieldname].
In the "Update to" field for closing date, enter =Forms![formname]![closing
date fieldname]
In the code for the command button, enter the following code to update the
children's table before closing the form:
DoCmd.OpenQuery "queryname", acNormal, acEdit
where "queryname" is the query you just created.
:
I have two queries one with parens information and one with their childrens
information both queries are link. When i enter a closing date on the parents
record i need for the childs record to automatically close. How can i do it?
Do i need a closing date field under the children table and close it manually?