Help with deleting record in subform

Flora2021

Board Regular
Joined
Apr 28, 2022
Messages
52
Office Version
  1. 365
Platform
  1. Windows
Hi, I have a simple subform that relates back to a single table.
I created a simple button from the wizard to be able to delete a record.
Well it works fine to delete in the subform but it remains in the table.
If I view it in the table and then go back into the subform, the record then pops back up in the subform.
How do I use this delete button to remove the record from both the table and subform? Thanks,
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
you have to add a (hidden) field where the table row is kept so whne you press the delete form if refers to that value and removes the data in that table row and of cuse clear the form.
I suggest you take a look at this link not for the deletion but especially for working with tables.
 
Upvote 0
you have to add a (hidden) field where the table row is kept so whne you press the delete form if refers to that value and removes the data in that table row and of cuse clear the form.
I suggest you take a look at this link not for the deletion but especially for working with tables.
This is an Access question?
 
Upvote 0
Hi, I have a simple subform that relates back to a single table.
I created a simple button from the wizard to be able to delete a record.
Well it works fine to delete in the subform but it remains in the table.
If I view it in the table and then go back into the subform, the record then pops back up in the subform.
How do I use this delete button to remove the record from both the table and subform? Thanks,
Need to show the code, as it cannot be deleting the record?
 
Upvote 0
This is an Access question?
I
you have to add a (hidden) field where the table row is kept so whne you press the delete form if refers to that value and removes the data in that table row and of cuse clear the form.
I suggest you take a look at this link not for the deletion but especially for working with tables.
Okay, how would I go about doing this? I did not write any code I just use the command button wizard. I am somewhat new to access so I apologize for not understanding how to accomplish this.
I thought that by using the command delete button it would delete the record. This is the only code I see for this command button
 

Attachments

  • 3.PNG
    3.PNG
    9.8 KB · Views: 12
  • 4.PNG
    4.PNG
    15.9 KB · Views: 12
Upvote 0
I

Okay, how would I go about doing this? I did not write any code I just use the command button wizard. I am somewhat new to access so I apologize for not understanding how to accomplish this.
I thought that by using the command delete button it would delete the record. This is the only code I see for this command button
Also I noticed I put subform. This is just a regular form created by the wizard. Not a subform. Thanks,
 
Upvote 0
I suggest you attach a non-private sample file with some data and what you have as macros, will be easier to explain; if your VBA knowledge is limited it might sound like abracadabra, but ... patience and prectice will get you there.
Main rule: patience, time and logig
 
Upvote 0
Also when I right click the delete option is greyed out if that matters?
 

Attachments

  • 5.PNG
    5.PNG
    29.2 KB · Views: 8
Upvote 0
Urgh macroes. I hate them.
Do you get a beep?. What happens if you just open the form and just delete the record?
Might be easier to upload a sample db with just enough to see the problem.?
However I only have 2007 and might not be able to open it.

You can convert macroes to VBA, which is much more flexible and used more widely than macroes.

 
Upvote 0
I suggest you attach a non-private sample file with some data and what you have as macros, will be easier to explain; if your VBA knowledge is limited it might sound like abracadabra, but ... patience and prectice will get you there.
Main rule: patience, time and logig

ep?. What happens if you just open the form and just delete the record?
Urgh macroes. I hate them.
Do you get a beep?. What happens if you just open the form and just delete the record?
Might be easier to upload a sample db with just enough to see the problem.?
However I only have 2007 and might not be able to open it.

You can convert macroes to VBA, which is much more flexible and used more widely than macroes.

How do you attach a file? I thought we could only attach images here?
When I delete it, it looks like it temporarily removes the record from the form. It gives a prompt about being sure if I want to delete the record, and then If you delete record say id 106, and then you toggle the forward and backwards record buttons it goes from 105 to 107 however, if you then open the table that its linked back to the record is still there then if you open the form again record 106 is back. It is very strange.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top