Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1

Status
Not open for further replies.

jdwm2310

Technical User
Jul 26, 2001
396
US
Please Help...I have a form called Employee Profile, the form has 4 command buttons:
(1) Preview report button, (2)Add record button, (3)Exit form button, and now a (4)Delete Record button.. I want the 4th button not only to delete the record but also any related record.
For example, in the Employee Profile form, I have a person name James Carbon, if I delete his record it is only going to delete the record from this form I want when I click on Delete Record to delete all of James Carbon's record from other forms. Please Help if you need anymore information I will quickly provide them...Thanks
 
Is your data all in one table or is it in a series of linked tables?

If it is linked then you can edit the relationships between the tables to make Access delete any child records when the parent record is deleted.

If not have you considered splitting your data? It will make your database more efficient and save disk space too.
 
the data is in 2 tables (Employees:table) and (SERP Plan:table). I am trying to create a relationship but the relationship type is indeterminated and when I try to enforce referential integrity, a dialog box open stating that there is no unique index found for the referential field fo the primary table.

I am not too familar with splitting my data, can you please provide details
 
Here goes: You need to define a 'primary key' field in your main table (Employees:table i assume). A primary key is a unique reference number that Access uses to identify records. The easiest way is to add a field to your Employees table called 'EmployeeID'. Make the data type of this field 'autonumber'. Access then automatically increments this number by one for each new record. Make this field the primary key field by clicking the button with a key on it in the table design window.

Then in your Serp plan table add a field called 'EmployeeID', data type = number, and a field named Serp planID, data type = autonumber (again make this the primary key for the table.

Open the relationships window. Drag Employee.EmployeeID onto Serp plan.EmployeeID. Check the 'enforce referential integrity' and 'cascade update.../cacade delete...'check boxes.

You should now have created a one to many relationship between the two tables.

Hope this helps, once you start to pick it up Access really is very easy to work with. I would recommend investing in a decent textbook and working through the fundamentals of databases and Access before going any further though.

I have found (through bitter personal experience!;-)) that by far the most important stage when building your database is planning. If you get the prep right, the rest should follow pretty naturally. If not there is always help here!
 
I did exactly has you told me and guess what It WORKED !!!!
I am definitely going to get myself some Access Books...Thanks for your help and your advice ;-)
 
Going to get Access books? Good lord, I know "Help" contains a lot of info, but I'm always refering to my little library.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top