Solved

MS Access coding help matching data and deletion from two linked tables

Posted on 2002-04-12
3
127 Views
Last Modified: 2013-11-27
I have built an access database that uses forms. I am having trouble with trying to delete a piece of data.
The project is a car parking system and in the main screen is portrayed the registration number. when this is clicked a form (car edit form)appears to enable the car details to be changed with the registration number locked ie. not able to be edited but appears on the screen. To sell the car a button is clicked to produce the customer entry form and then the customer details are taken and then the form is closed.
I want to be able to take the registration number from the car edit form and delete it from two linked table the first of which is the space table and the next is the cars table. How do I do this?
0
Comment
Question by:Lyndonbatchelor
3 Comments
 
LVL 5

Accepted Solution

by:
kcm76 earned 150 total points
ID: 6937922
this may help u
have u given cascade delete records in referential integrity, u just delete the record in master table.
like delete * from master_table where registration_number = " & CLng(txtregistration.text)

otherwise, u have to delete it from the detail table first.

delete *
from detail_table, master_table
where detail_table.ForeignKeyField = master_table.PrimaryKeyField and master_table.registration_number = " & Clng(txtregistration.text)

for deleting in the master table, as mentioned earlier,

delete * from master_table where registration_number = " & CLng(txtregistration.text)

ALL THE BEST




0
 
LVL 16

Expert Comment

by:twalgrave
ID: 7755019
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in Community Support that this question is:
- points to kcm76
Please leave any comments here within the
next seven days.
0
 

Expert Comment

by:SpideyMod
ID: 7812395
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
sql statement - 9 25
Access Update Query 1 20
Display <> "Yes" records 10 10
Visible ppty on rpt 7 6
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question