Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 133
  • Last Modified:

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

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
Lyndonbatchelor
Asked:
Lyndonbatchelor
1 Solution
 
kcm76Commented:
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
 
twalgraveCommented:
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
 
SpideyModCommented:
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now