can't delete record

I am trying to use a command button on a form to delete the current record 
displayed on the form. The record has several related fields in other tables, 
but I believe I have successfully deleted all related records with delete 
queries.
When I run the code 
DoCmd.RunCommand acCmdDeleteRecord
the confirm delete message comes up, and after clicking through it the form 
goes blank, appearing like a successful deletion. No error messages. However 
the record is still in the table. In table view there isn’t any problem 
deleting the record in question i.e. no related records.
I’ve tried using a wizard generated delete button with the same results.
Any ideas? 

0
Utf
1/14/2008 6:13:02 PM
access.forms 6864 articles. 2 followers. Follow

4 Replies
810 Views

Similar Articles

[PageSpeed] 46

Chas,
sounds like you are trying to delete the current record before it has been 
saved.
When you close the form, the record is saved and that is why it can be 
deleted from the table after you close the form.
You won't be able to delete when you are at a new record, and you won't be 
able to delete a dirty record.
Try something like this:

If Not Me.NewRecord = True Then
    If Me.Dirty Then
        Me.Undo
    Else
        DoCmd.RunCommand acCmdDeleteRecord
    End if
End if

Jeanette Cunningham

"chasday" <chasday@discussions.microsoft.com> wrote in message 
news:FE99C73F-D651-491E-A286-E62FB68D000D@microsoft.com...
>I am trying to use a command button on a form to delete the current record
> displayed on the form. The record has several related fields in other 
> tables,
> but I believe I have successfully deleted all related records with delete
> queries.
> When I run the code
> DoCmd.RunCommand acCmdDeleteRecord
> the confirm delete message comes up, and after clicking through it the 
> form
> goes blank, appearing like a successful deletion. No error messages. 
> However
> the record is still in the table. In table view there isn't any problem
> deleting the record in question i.e. no related records.
> I've tried using a wizard generated delete button with the same results.
> Any ideas?
> 


0
Jeanette
1/14/2008 9:38:49 PM
I still get the same result after I close the record and re-open it, so I 
know it's not Dirty.

"Jeanette Cunningham" wrote:

> Chas,
> sounds like you are trying to delete the current record before it has been 
> saved.
> When you close the form, the record is saved and that is why it can be 
> deleted from the table after you close the form.
> You won't be able to delete when you are at a new record, and you won't be 
> able to delete a dirty record.
> Try something like this:
> 
> If Not Me.NewRecord = True Then
>     If Me.Dirty Then
>         Me.Undo
>     Else
>         DoCmd.RunCommand acCmdDeleteRecord
>     End if
> End if
> 
> Jeanette Cunningham
> 
> "chasday" <chasday@discussions.microsoft.com> wrote in message 
> news:FE99C73F-D651-491E-A286-E62FB68D000D@microsoft.com...
> >I am trying to use a command button on a form to delete the current record
> > displayed on the form. The record has several related fields in other 
> > tables,
> > but I believe I have successfully deleted all related records with delete
> > queries.
> > When I run the code
> > DoCmd.RunCommand acCmdDeleteRecord
> > the confirm delete message comes up, and after clicking through it the 
> > form
> > goes blank, appearing like a successful deletion. No error messages. 
> > However
> > the record is still in the table. In table view there isn't any problem
> > deleting the record in question i.e. no related records.
> > I've tried using a wizard generated delete button with the same results.
> > Any ideas?
> > 
> 
> 
> 
0
Utf
1/14/2008 10:51:01 PM
Chas,
another thing to check:
Check the required property of each field in the recordsource for the form. 
To do this, open the appropriate tables and in the lower pane of the table 
in design view see if any have their required property set to true. If so, 
that is done for a very good reason and we won't change that.
Are you comfortable with writing some VBA code to delete a record?

Jeanette Cunningham

"chasday" <chasday@discussions.microsoft.com> wrote in message 
news:FE99C73F-D651-491E-A286-E62FB68D000D@microsoft.com...
>I am trying to use a command button on a form to delete the current record
> displayed on the form. The record has several related fields in other 
> tables,
> but I believe I have successfully deleted all related records with delete
> queries.
> When I run the code
> DoCmd.RunCommand acCmdDeleteRecord
> the confirm delete message comes up, and after clicking through it the 
> form
> goes blank, appearing like a successful deletion. No error messages. 
> However
> the record is still in the table. In table view there isn't any problem
> deleting the record in question i.e. no related records.
> I've tried using a wizard generated delete button with the same results.
> Any ideas?
> 


0
Jeanette
1/14/2008 11:25:14 PM
I found a work-around
I close the form and then delete the record.
            ProjectID = Me.ProjectID  
            'Close this form
            DoCmd.Close
                        
            'Delete the record
            strSQL = "DELETE * FROM [tblProjects] " & "WHERE [ProjectID] = " 
& ProjectID
            CurrentProject.Connection.Execute strSQL

It doesn't seem like I should have to do it this way, but it works.

"Jeanette Cunningham" wrote:

> Chas,
> another thing to check:
> Check the required property of each field in the recordsource for the form. 
> To do this, open the appropriate tables and in the lower pane of the table 
> in design view see if any have their required property set to true. If so, 
> that is done for a very good reason and we won't change that.
> Are you comfortable with writing some VBA code to delete a record?
> 
> Jeanette Cunningham
> 
> "chasday" <chasday@discussions.microsoft.com> wrote in message 
> news:FE99C73F-D651-491E-A286-E62FB68D000D@microsoft.com...
> >I am trying to use a command button on a form to delete the current record
> > displayed on the form. The record has several related fields in other 
> > tables,
> > but I believe I have successfully deleted all related records with delete
> > queries.
> > When I run the code
> > DoCmd.RunCommand acCmdDeleteRecord
> > the confirm delete message comes up, and after clicking through it the 
> > form
> > goes blank, appearing like a successful deletion. No error messages. 
> > However
> > the record is still in the table. In table view there isn't any problem
> > deleting the record in question i.e. no related records.
> > I've tried using a wizard generated delete button with the same results.
> > Any ideas?
> > 
> 
> 
> 
0
Utf
1/15/2008 2:20:00 AM
Reply:

Similar Artilces:

Deleting a CRM User
I am at bit of a loss here. I thought that the CRM system operated user management through AD. However, I have 2 users that are listed under Server Manager - Advanced - Microsoft CRM - Users taht are not in AD, and I also cannot delete them from this user list. Because they are listed as CRM users, running the RUle Deployment Wizard fails because of these 2 bogus users. How do I get rid of these 2 user entries in CRM? Can't be done at all easily: http://crmuser.blogspot.com/2007/02/deleting-users-from-ms-dynamics-crm.html -- Mike Bristol, UK CRM user www.crmuser.blogspot.com ...

Append New Record Via A Form?
Have never used Append Queries and therefore lack the knowledge of the same. I have a sample table "Students" with fields like: 1. ID (AutoNumber) 2. Name (Text) 3. Nationality (Lookup with Row Source being Selection from the table "Countries") 4. Date of Birth (Date) Now I want to create a form which would not be showing the records already in the database but simply present a one page layout with the 4 controls for each of the fields and a button which upon being clicked shall add the data entered in the same to the Table "Students". Please c ...

can't delete record
I am trying to use a command button on a form to delete the current record displayed on the form. The record has several related fields in other tables, but I believe I have successfully deleted all related records with delete queries. When I run the code DoCmd.RunCommand acCmdDeleteRecord the confirm delete message comes up, and after clicking through it the form goes blank, appearing like a successful deletion. No error messages. However the record is still in the table. In table view there isn’t any problem deleting the record in question i.e. no related records. I’ve tried using a w...

Urgent!!! e02.log deleted by Symantec Antivirus
Please help, Information Store can not mount. due to virus nestsky P I can not undeleted. How can i fix it? Urgent!!!!! Do not scan the exchsrvr dirs or M: drive. Do you have a good backup? On Sun, 13 Jun 2004 01:51:01 -0700, "boonsitc@hotmail.com" <boonsitc@hotmail.com@discussions.microsoft.com> wrote: >Please help, Information Store can not mount. due to virus nestsky P >I can not undeleted. How can i fix it? >Urgent!!!!! Restore from your last backup. -- Mark Fugatt Exchange MVP http://www.exchangetrainer.com http://www.msexchange.org "boonsitc@hotmai...

Changing Delete Privilege for a Role Does not Take Effect
Hi There A particular user has one role - "Salesperson". I went into the saleperson role, to core records. The Salesperson role has "User" delete privelege for accounts and contacts. I change the delete privelege to "None Selected" for account and contact deletion. Then I save the role. When I come back to the role, the save has not taken effect. The Salesperson role still has "User" delete privileges on accounts and contacts. What am I doing wrong? TIA Bill ...

Delete Financial Series Inventory Batches
Is there an easier way to delete Financial Series Inventory Batches that we don't want posted to the GL? We don't want to have to open each batch ID and click delete for each of these batches that we need removed. Is there a 'mass delete' functionality that we could use? Thanks. New VBA form can be easily developed to cover this requirment, i don't think you can manage this issue in Great Plains forms. Regards, Mohammad Daoud "Banner" wrote: > Is there an easier way to delete Financial Series Inventory Batches that we > don't want posted to ...

Is there a way to delete multiple lines at the same time beside u.
Please let me know if there is other ways to delete multiple lines at the same time without using the Ctl key. Thank you. Hi Cherry are the lines adjacent to one another? if so just drag down the row numbers and then right mouse click & choose delete .. .if they're not adjacent and you don't want to use the Ctrl key to select them, how are you going to identify which rows you want to delete? -- Cheers JulieD check out www.hcts.net.au/tipsandtricks.htm ....well i'm working on it anyway "cherry" <cherry@discussions.microsoft.com> wrote in message news:4BD...

delete all characters after an character
Hi I have a spread sheet where I have a colum with pack size ex: 10/20'. I would like to remove all character after the slash (/). I cannot use any of amount of character beacause it's not always the same format but the slash is always there. Remember I have over 10000 lines. Thank any help will be appreciated. try this. Also removes the / Sub findslash() For Each c In Selection x = InStr(c, "/") - 1 MsgBox Left(c, x) Next End Sub -- Don Guillett SalesAid Software donaldb@281.com "Jean-Francois Boucher" <Jean-Francois Boucher@discussions.microsoft.com&g...

Deleting Public Holidays
After entering public holidays for a country in O2003, how do you delete them? I find that countries I imported from the previous version of Outlook are not even checked so I cannot uncheck them to delete them. Outlook seems oblivious to them. Thanks, Andrew Sort you Calendar in the By Category view. You can now easily remove the Holidays. -- Robert Sparnaaij [MVP-Outlook] www.howto-outlook.com Tips of the month: -What do the Outlook Icons Mean? -Create an Office 2003 CD slipstreamed with Service Pack 1 ----- "Andrew Chalk" <achalk@XXXmagnacartasoftware.com> wrote in ...

How Do I delete a check box.
I was cutting and pasting text to an Excel file and now I have a check box on the spreadsheet. I tried right-clicking around it to select it and tried left clicking around it. How can I select it so I can remove it from the sheet? Thanks for the help!! -- akkrug =?Utf-8?B?YWtrcnVn?= <kenneth.krug@uticanational.com> wrote in news:B4689D71-B565-4A1B-974E-EB1493A46FDC@microsoft.com: > I was cutting and pasting text to an Excel file and now I have a check > box on the spreadsheet. I tried right-clicking around it to select it > and tried left clicking around it. How c...

#REF! after cell deletion
Hi there Imagine you have two sheets in an Excel workbook, and for instance 'Sheet 1' looks at the values in 'Sheet 2' courtesy of a column filled with formula something like this: =Sheet2!A1 =Sheet2!A2 =Sheet2!A3 etc. Is it possible to prevent Excel from replacing the formula at say: A2 in 'Sheet 1' with "#REF!", when the row containing A2 on 'Sheet 2' is deleted? -- Colin G Eastwood Hi try =INDIRECT("'sheet2'!A1") -- Regards Frank Kabel Frankfurt, Germany "Colin G Eastwood" <eastwoc@rudge0.demon.co.uk> schri...

OE6 Deletes Attachments that are Ok
I recently updated my OE to version 6 - and it seems that since that time, there are numerous e-mails with attachments that OE is removing the attachment. These are coming from people I know. Is there something I can do or settings I can change to stop this from happening? Tools | Options | Security... This newsgroup is for support of Outlook 97, 98, 2000, 2002 & 2003 from the Office family for Intel PCs. For Outlook Express (OE) support try posting in one of these newsgroups: microsoft.public.inetexplorer.ie4.outlookexpress for OE 4.x microsoft.public.windows.inetexplorer.ie5.outl...

print a record
I have a multi user application and I would like the user to be able to print a report anytime after they have submitted the data. The user inputs data on a form. The user may need to print a report of that data a week later. Is there anyway for the user to view and/or print just the record they submitted? Shari The line of code for a command button on the form with the record to be printed: DoCmd.OpenReport "ReportName", acViewPreviw, , "IDField = " & Me.txtIDField where ReoportName is the report's name, IDField matches the ID field name and txtIDField ...

Ole objects in records/tables
I have a question every time I tried to go to word and powerpoint and says type a prodect key I typed from the back of my labtop but it keeps saying it wrong.So what do I do? WHAT??????? "Kevin Ramos" <kevin's email> wrote in message news:%23X$8BdeQIHA.2268@TK2MSFTNGP02.phx.gbl... >I have a question every time I tried to go to word and powerpoint and says >type a prodect key I typed from the back of my labtop but it keeps saying >it wrong.So what do I do? ...

Unique records in Excel
Hi does anyone know how to ensure Unique data when making entries in an Excel spreadsheet ? Say Part Numbers or account numbers etc Thanks :confused: -- gilsondg ------------------------------------------------------------------------ gilsondg's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=15878 View this thread: http://www.excelforum.com/showthread.php?threadid=273641 There's a method using Data Validation and COUNTIF. Debra Dalgleish's website has an example of how to set this up: http://www.contextures.com/xlDataVal07.html HTH Jason Atla...

find affected tables when creating a new record in CRM frontend
How can I find out what tables which new record has been added on when I enter data through a form in CRM front end? I try to find way to map form in the CRM frontend to the tables at the CRM database at backend? It is CRM 3.0 Thank in advances for help! On Nov 9, 12:12=A0pm, VistaUser123 <sunmapleleaf...@yahoo.com> wrote: > How can I find out what tables which new record has been added on when I > enter data through a form in CRM front end? I try to find way to map form= in > the CRM frontend to the tables at the CRM database at backend? It is CRM = 3.0 > > Thank in...

how to delete templates
I have publisher templates I wish to delete. Please how to do this. I have Excel 2003 Do you have Publisher? What OS? In Windows XP the Publisher templates are in a folder similar to this (hidden). C:\Documents and Settings\<<user name>>\Application Data\Microsoft\Templates Vista, also hidden C:\Users\<<user name>>\AppData\Roaming\Microsoft\Templates -- Mary Sauer MSFT MVP http://office.microsoft.com/ http://msauer.mvps.org/ news://msnews.microsoft.com "david winkley" <david winkley@discussions.microsoft.com> wrote in message news:ABC03B00-049C-4...

Access Deleting a Query SQL
Hi all, I am working with a multiple parameter search query. The form I am using to conduct the search displays the results in a subform. I have gone through and really combed through the SQL to make sure there are no blatant spelling errors or incorrect references within the code. Anyways when I open the form that it is attached to, I keep getting the boxes described in this website http://allenbrowne.com/bug-13.html .. The form is open, and I even changed names of fields in the table in case SQL was choosing to be picky about what I named my fields. Is there anything else that would cau...

Delete 2 bytes from a file
I open a file,its size exceed 20M bytes.I want to delete 2 bytes from the given position (anywhere) now. I call memmove to move all data after the position,e.g: memmove(buff,buff+2,size),but it's inefficient. Who can give a better way? Thanks. _____________________________________________________ http://www.msale.net/bbs/ a Chinese-language message board for developers,including palm,ppc,symbian,and etc. http://www.zirong.net/blog/ my private life Miken wrote: > I open a file,its size exceed 20M bytes.I want to delete 2 bytes from the > given position (anywhere) now. > I cal...

how to delete a partly transmitted message
I have a partly transmitted outgoing email message in outlook which includes eight photo attachments which appears to have jammed. How do I clear it? Place Outlook in Offline mode via File-> Work Offline. Restart Outlook and you should be able to delete it. For other solutions see; http:/www.howto-outlook.com/faq/messagestuckinoutbox.htm -- Robert Sparnaaij [MVP-Outlook] Coauthor, Configuring Microsoft Outlook 2003 http://www.howto-outlook.com/ Outlook FAQ, HowTo, Downloads, Add-Ins and more http://www.msoutlook.info/ Real World Questions, Real World Answers -----...

Delete rows in table if checkbox value in first cell equals true
Hi People, First time caller long time observer. I'm creating a form which contains three tables. First two tables contain information such as heading, date, time, user details etc. Table three consists of 2 rows and 5 columns. First row is used for column headings and second row contains form fields where the user can record their data. The first cell of row 2 contains a checkbox and the rest contain text fields. Now, I would like the user to have the ability to add and remove rows at click of a button. After couple hours of researching I figured out the code that...

Find Record in Subform
I currently have a find record command button on the main form. When I use the main form find button it only searches fields in the main form. I would like the ability to search ALL the records in a subform using a find record command button. Currently when I put a find record button on the subform it only searches the record currenly displayed. Is there any way to seach (for example) ALL the Titles in that subform table? On Nov 5, 2:43 pm, Reb <RebKayGom...@gmail.com> wrote: > I currently have a find record command button on the main form. When I > use the main form find button...

Automatically Deleting Emails
Hello, I was wondering if anyone could help me? Ever since clicking 'Yes' on a pop up from windows mail, it gets rid of all of my open emails, which is very inconvienient, and i have no idea where the emails go! Although they show in my webmail account online, they arent anywhere in Windows Mail. Any help to rectify this would be much apperciated. Michelle "Meeshell" <Meeshell@discussions.microsoft.com> wrote in message news:0F0E1052-FD78-4299-90E6-D86964F1C460@microsoft.com... > Hello, > > I was wondering if anyone could help me? >...

Delete is grayed out-disabled?
Outlook XP- with pop3 email t9o a local pst.. When I highlight a single message (without opening it) I cannot delete the message. If I open the message or if I select a single message as part of a multiple selection (2 or more messages) I can delete it (them). Any ideas? Thank you How are you trying to delete the email? You can highlight and click the X button on your toolbar to delete, you can highlight and press the delete key on your keyboard, you can highlight then right-click and scroll to delete, or you can open the email and click the X button on the toolbar in the open e...

If statement to export query if record count is not null
Greetings, thank you very much to all who are reading this. Basically I have an automated email that goes out every Monday. Very simply it uses sendobject to email a query. I would like to add some logic that basically looks at the record count and if it isn't null...sends teh email as is...if the record count is empty I would like to have it send an email that basically says "The record set this week is empty." Below is the module converted from the original macro. I was having trouble modifying the module so any help would be greatly appreciated. Thanks in ...