How to Delete Record on Subform Whose Source is a Query (1 Viewer)

cblaine99

Registered User.
Local time
Today, 08:15
Joined
Mar 10, 2016
Messages
29
Hello,

I am trying to make some changes to a form in an Access database application designed by someone else. I am also learning Access as I go along.

The form I want to change has a subform that shows contacts for a company. The subform is populated by a query.

I've noticed that I can edit fields in the records that are shown on the subform. I can also add a record.

I also want to be able to delete a record. But if I select a record (by clicking
in the record selector column) and then right-click the context menu shows
that "Delete Record" is disabled. (Please see attached image.)

Is there a way to enable the deleting of records in the datasheet? Perhaps there's an option when running the query that allows the records in the resulting datasheet to be deleted?

Thank you.
 

Attachments

  • Customer.gif
    Customer.gif
    45.9 KB · Views: 52

Dreamweaver

Well-known member
Local time
Today, 16:15
Joined
Nov 28, 2005
Messages
2,466
You could add a button using the wizard to create a delete button on the left of the continuous form or click the record selector and press delete on your keyboard one way should work


mick
 

isladogs

MVP / VIP
Local time
Today, 16:15
Joined
Jan 14, 2017
Messages
18,209
Open the sub form in design view and open its properties sheet. In the Data tab make sure Allow Deletions = Yes


Sent from my iPhone using Tapatalk
 

Dreamweaver

Well-known member
Local time
Today, 16:15
Joined
Nov 28, 2005
Messages
2,466
Open the sub form in design view and open its properties sheet. In the Data tab make sure Allow Deletions = Yes


Sent from my iPhone using Tapatalk




Lol Didn't see the delete option on the shortcut toolbar
 

Micron

AWF VIP
Local time
Today, 11:15
Joined
Oct 20, 2018
Messages
3,478
Try deleting from the query itself. If you can then
- maybe Allow Deletions is set to no on the form, or
- try unchecking "allow layout view" from 'current database' options
EDIT : the table involved isn't a sql server (or similar) table by any chance?
 
Last edited:

cblaine99

Registered User.
Local time
Today, 08:15
Joined
Mar 10, 2016
Messages
29
The suggestion by MickJav solves the problem. If I select the record and press delete the record is deleted. Thanks to everyone for their suggestions.
 

Dreamweaver

Well-known member
Local time
Today, 16:15
Joined
Nov 28, 2005
Messages
2,466
One Note About that is anybody using the database can delete records I tend not to enable the record selector not sure if it will work without the selector?
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 16:15
Joined
Jul 9, 2003
Messages
16,271
One Note About that is anybody using the database can delete records

Picking up on what Michael said, it's definitely not a good idea to allow the user to delete records. There are many good reasons for this. One reason, "Reports" ... For example, imagine you allow the user to delete a superfluous entry from a Combo Box. When you run a report based on records supplied by this combo-box, you will have a blank in the report where the deleted items should appear.

The alternative is to flag the ComboBox item as deleted with a checkbox. When the user wants to delete the item from the combobox, they press the "flag checkbox" to show delete = True, however the item is not actually deleted, it's just hidden from the user's view. So you get a pseudo delete option, as far as the user is concerned they have deleted something, but as the developer, you have just Hidden the item.

Now the item will still appear in Reports and anywhere else you happen to use it.
 

Micron

AWF VIP
Local time
Today, 11:15
Joined
Oct 20, 2018
Messages
3,478
The suggestion by MickJav solves the problem. If I select the record and press delete the record is deleted. Thanks to everyone for their suggestions.

Too bad you didn't try the layout option, assuming you have it as "allowed" as it seems it was a known bug about 10 yeara ago. I always turn it off so I'd never know if it was fixed. Not being in the habit of deleting records would be another reason for not knowing if that works.
 

Users who are viewing this thread

Top Bottom