acCmdDeleteRecord (1 Viewer)

DevAccess

Registered User.
Local time
Yesterday, 16:39
Joined
Jun 27, 2016
Messages
321
Hi there

I have below code to delete the current records which should be deleted on delete button, but somehow it is not being deleted. however it is not giving any error as well.

Please let me know what is wrong, the form data is being populated based no query like name, telephone number and classroom data.

This is access 2016.

Code:
DoCmd.SetWarnings False
DoCmd.RunCommand acCmdDeleteRecord
cboGoToContact.Requery
 

moke123

AWF VIP
Local time
Yesterday, 19:39
Joined
Jan 11, 2013
Messages
2,528
you may very well be getting no error message as you have turned warnings off. You also dont appear to turn them back on and i believe that will persist throughout your session. Many prefer the currentdb.execute method for just that reason.
 

DevAccess

Registered User.
Local time
Yesterday, 16:39
Joined
Jun 27, 2016
Messages
321
you may very well be getting no error message as you have turned warnings off. You also dont appear to turn them back on and i believe that will persist throughout your session. Many prefer the currentdb.execute method for just that reason.

I am sorry but full code is like this.

DoCmd.SetWarnings False
DoCmd.RunCommand acCmdDeleteRecord
field1.Requery

DoCmd.SetWarnings True

The table which has been refer in the form query is having subdatasheet table as well, would this be an issue ?
 

moke123

AWF VIP
Local time
Yesterday, 19:39
Joined
Jan 11, 2013
Messages
2,528
not sure i'm following you. perhaps you can upload a sample.
 

DevAccess

Registered User.
Local time
Yesterday, 16:39
Joined
Jun 27, 2016
Messages
321

Attachments

  • Screenshot_2.png
    Screenshot_2.png
    6.6 KB · Views: 103

moke123

AWF VIP
Local time
Yesterday, 19:39
Joined
Jan 11, 2013
Messages
2,528
sorry, but that doesnt really help.
How and where are you invoking the code? what kind of form are you using?
 

DevAccess

Registered User.
Local time
Yesterday, 16:39
Joined
Jun 27, 2016
Messages
321
sorry, but that doesnt really help.
How and where are you invoking the code? what kind of form are you using?

it is form which populates result from query and shows data into different field of the form...

the button first edits the form and then we have above said code.
 

moke123

AWF VIP
Local time
Yesterday, 19:39
Joined
Jan 11, 2013
Messages
2,528
Have you tried commenting out your warnings and run the code to see if there is an error message? is referential integrity enforced with the subdata?
 

Users who are viewing this thread

Top Bottom