Solved

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

Posted on 2002-04-12
3
125 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

757 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now