subform and deletion help!

  • Thread starter Thread starter Andrew
  • Start date Start date
A

Andrew

I have a form that show multiple subforms with table
view, does any body know how to change the background of
the subform from that grey color to white like the table.

And second, is there an option or code that when you
delete a record, that all the following related records
will delete as well, in stead of having to delete all
records manually that is related to the main record?
 
To change colour - open the property sheet for the form's detail section and
change the Back Color property.

To have the child records automatically deleted the easiest way is to create
a relationship between the tables in question, enforce referential integrity
and turn on cascading deletes. (Look up relationships in help if you haven't
a clue what I'm talking about.)
 
To answer your second question ---

When you set up your relationships, if you checked Cascade Delete the related
records in the foreign key table will be deleted when you delete a record in the
primary key table. For example, if you have the tables:
TblCustomer
CustomerID
CustomerName

TblOrders
OrderID
CustomerID
OrderDate
etc

you have a relationship between CustomerID in both tables and you checked
Cascade Delete when you created the relationship. When you delete a Customer in
TblCustomer, all the Order records of that customer will also be automatically
deleted in TblOrders.

If you did not check Cascade Delete when you created the relationship, you can
go back to the Relationships Window, click on the join line and check Cascade
Delete.
 
Back
Top