Database Deleting Record Problem

Just launched a new database.  Using an Autonumber field to generate document 
numbers (sequence is not important - just need a unique identifier).  There 
are a number of fields that are required fields based on an option group 
selection.  Problem; If all required fields (they are required fields 
programmatically) are not completed and you attempt to exit the form, a 
message box appears asking " Do you want to save changes".  If you say "Yes" 
the form closes, does not save, and the record is deleted - but users are not 
aware of this deletion - and they think the record just created is just fine. 
 

Question 1.  I thought access saved automatically when you moved focus from 
a field or record.  Why does a message box appear asking if I want to save 
changes?  Is there a conflict between the required fields and automatic 
saving in access?

Question 2.  How do I prevent deletion of records?.

Any help is appreciated.

Thanks

-- 
Pin
0
Utf
10/19/2007 2:53:01 PM
access 16762 articles. 3 followers. Follow

2 Replies
964 Views

Similar Articles

[PageSpeed] 17

A1
The message indicates that the record cannot be saved in its current state. 
It is not deleted, because it never was saved.

By definition, you've told Access NOT to save the record if a required field 
is Null. So in this case, it cannot perform the default behavior of saving 
the record for you.

You're lucky you get a message at all. Years ago, you didn't. Even today, if 
you have code in a button that closes the form, the record is silently lost 
(no message at all) if it cannot be saved:
    http://allenbrowne.com/bug-01.html

A2.
To prevent the deletion of records, set your form's AllowDeletions property 
to No.

-- 
Allen Browne - Microsoft MVP.  Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Pin" <city@thedeeplake.com> wrote in message
news:1DB92C52-E48B-4768-9F6E-EB2751701BA5@microsoft.com...
> Just launched a new database.  Using an Autonumber field to generate 
> document
> numbers (sequence is not important - just need a unique identifier). 
> There
> are a number of fields that are required fields based on an option group
> selection.  Problem; If all required fields (they are required fields
> programmatically) are not completed and you attempt to exit the form, a
> message box appears asking " Do you want to save changes".  If you say 
> "Yes"
> the form closes, does not save, and the record is deleted - but users are 
> not
> aware of this deletion - and they think the record just created is just 
> fine.
>
>
> Question 1.  I thought access saved automatically when you moved focus 
> from
> a field or record.  Why does a message box appear asking if I want to save
> changes?  Is there a conflict between the required fields and automatic
> saving in access?
>
> Question 2.  How do I prevent deletion of records?.
>
> Any help is appreciated.
>
> Thanks
>
> -- 
> Pin 

0
Allen
10/19/2007 3:05:29 PM
What command is being used to close the form? That message sounds a lot like 
the prompt asking if you want to save changes *to the form* not the record. 
2 entirely different things, and certainly not what your users would think 
they are being asked. As a matter of fact, I don't think Access ever asks 
whether u want to save record changes. It always assumes you do and will if 
it can. So, unless that message is something added by your own code, I 
suspect it's referrung to form changes, not record changes. I suggest you 
don't let it ask the question in the first place since its so misleading and 
the answer would probably always be "No".

DoCmd.Close acForm, strFormName, acCloseSave

acCloseSave is a vb constant and can have one of 3 values:
    acSaveNo
    acSavePrompt (default)
    acSaveYes

remember, this pertains to changes in the *form*, not the data.  I rarely 
have this set to anything other than acSaveNo.
In addition to having Form.AllowDesignChanges set to False (i.e., DesignView 
only)

Changes to a form design would include a simple change to the recordsource 
of a control, something that is done a lot during runtime. If that change 
gets saved, that's how the form will open next time. That is rarely 
desirable.

HTH,




"Pin" <city@thedeeplake.com> wrote in message 
news:1DB92C52-E48B-4768-9F6E-EB2751701BA5@microsoft.com...
> Just launched a new database.  Using an Autonumber field to generate 
> document
> numbers (sequence is not important - just need a unique identifier). 
> There
> are a number of fields that are required fields based on an option group
> selection.  Problem; If all required fields (they are required fields
> programmatically) are not completed and you attempt to exit the form, a
> message box appears asking " Do you want to save changes".  If you say 
> "Yes"
> the form closes, does not save, and the record is deleted - but users are 
> not
> aware of this deletion - and they think the record just created is just 
> fine.
>
>
> Question 1.  I thought access saved automatically when you moved focus 
> from
> a field or record.  Why does a message box appear asking if I want to save
> changes?  Is there a conflict between the required fields and automatic
> saving in access?
>
> Question 2.  How do I prevent deletion of records?.
>
> Any help is appreciated.
>
> Thanks
>
> -- 
> Pin 


0
George
10/19/2007 4:28:36 PM
Reply:

Similar Artilces:

Linq, aggregate Sum problem
Hi, I figured out that I am unable to query for an aggregate function (Sum) over a column I have properly filled. The following NUnit test method will fail due to a NULL value even i think this should not be true: Provisionsabrechnung.UnitTests.Provisionsrechner.Test_Aggregate_Sum_with_Null: System.InvalidOperationException : Das Objekt mit Nullwert muss einen Wert haben. public void Test_Aggregate_Sum_with_Null() { ProvisionsabrechnungDataContext dataContext = new ProvisionsabrechnungDataContext(); Objektverkauf o1 = new Objektverk...

Emptying 'Deleted Items' folder on exit
I am running WLM version 2009 (Build 14.0.8089.0726) on Windows 7 with all the latest updates. I have 'Empty messages from the Deleted Items folder on exit' checked under Maintenance, but they're all still there when I exit and restart WLM. Is there another setting I should be looking at to make this work? TIA, -- SC Tom Tom, I experienced the same thing earlier today. I'm new to WLM and found that if you "checked" the ''Empty messages from the Deleted Items folder on > exit' after there were items in the Deleted Items folder, it ...

Crazy Sorting Problem.....
Ok so I have colums A though D that need to line up with E through P. I have a common symbol in D and F. I need to get rid of everything in colum A through D that does not line up with the E through P useing the common symbol as a referance. I am right now deleting extra info by hand. Please help. Hi see your other post -- Regards Frank Kabel Frankfurt, Germany Neal wrote: > Ok so I have colums A though D that need to line up with E through P. > I have a common symbol in D and F. I need to get rid of everything in > colum A through D that does not line up with the E through P ...

print a record in form view
I am building a form and have inserted an event procedure to have the form print one record at a time and it will only print a blank piece of paper. This is my code, can anyone tell me what they think is wrong? Any help is greatly appreciated. rivate Sub cmdPrint_Click() On Error GoTo Err_cmdPrint_Click DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70 DoCmd.PrintOut acSelection Exit_cmdPrint_Click: Exit Sub Err_cmdPrint_Click: MsgBox Err.Description Resume Exit_cmdPrint_Click End Sub Assuming that the line rivate Sub cmdPrint_Click() is only missi...

WaitForSingleObject Problem
Hi all, I use WaitForSingleObject(hProcess, INFINITE) to wait for execution of the MS ActiveX Control Pad Setup (started out of my application). <code> CreateProcess(NULL, "setuppad.exe", NULL, NULL, FALSE, DETACHED_PROCESS, NULL, NULL, &startupInfo, &processInfo) WaitForSingleObject(processInfo.hProcess, INFINITE) DoSomethingElse </code> At the beginning of installation everything is fine, but after a little bit of time, the CPU usage is 50% and nothing is going on (it's after searching for installed components). When I don't use WaitForSingleOb...

Problem Syncronizing.
HI, I have problems with a syncronized store that I had to syncronize again from the beginning. Give me alot of TIme out when I use the 401 Worksheet. Since some of the data is in the HQ Database I would like to know if there any operation I can do so then tell to the HQ client that I just want to upload some information?. Thanks in advance for your help. Rgds Rodrigo Go to Manager, Help, About. If your version is 1.2.0151 you have a version that won't work with Global Customer turned on. Contact MBS and ask for a Hot Fix to address this issue. Install the Hot Fix on all PC...

INSERT INTO problems
Hi all, I hope this doesn't appear twice, I did it a while ago and it never came up! So here goes again! I am trying to use INSERT INTO to insert one record in to a table (tna feedback) in two fields (USER ID: and DESK/LAPTOP). The values are generated by two different forms; stUser comes from this form and stMachine comes from another form which has been hidden once the user has chosen the value. This part works fine. However, every time I run it I get an "Incomplete Query clause" error message but can't fidure out what I've done wrong! Here is the code: Dim SQL ...

Access 2000 Package and Deployment Wizard problem!
I have created an Access 2000 application that I now wish to distribute to users as an MDE file. The Access 2000 Package and Deployment Wizard does a fine job of storing the relevant installation files on a CD, exploiting A2K Runtime. However, I would prefer to let users download my application from a website. The Package and Deployment Wizard offers a 'Web Publishing' deployment option that appears to address this need. My only problem is that it doesn't work for me. I get the following error message, Unexpected error number 48 has occurred: File not found: WebPost.dll I...

Button to go to a specific record in a form
Hello, I have two forms. I need to use a command button to go to a second form's specific record. a. In the wizard, when it is time to chose the fields to match, there is nothing in the left side of the screen. b. How do I do this in code. Thnaks for all of your help. Joe In the Click event of the command button, use the primary key field of the record you want to open in the second form in the OpenForm Where argument. This is a good example in VBA Help. -- Dave Hargis, Microsoft Access MVP "Joe C" wrote: > Hello, > > I have two forms. I need to use a c...

How do I get deleted items that stay in inbox with line thru them.
I inherited a computer at work. Outlook is setup so that when I delete a message it stays in the inbox, with a line thru it. How do I get the deleted items to go automatically to the deleted item folder? "rwwhit" <rwwhit@discussions.microsoft.com> wrote in message news:7D17761E-CD1B-4D04-BACB-B0D837C4DD93@microsoft.com... >I inherited a computer at work. Outlook is setup so that when I delete a > message it stays in the inbox, with a line thru it. How do I get the deleted > items to go automatically to the deleted item folder? That's normal behavior...

Count problems[Excel 97]
Hi there, I did a search on the forum to find an answer to my question but didn' find anything. Here is my prob : Lets say I got this page-> ___a___b_____c__d__ 1 Name Type Job bla 2 Name Type Job bla 3 Name Type Job bla 4 Name Type Job bla 5 Name Type Job bob I want a Cell to write how many row I got( 5 in this exemple) and onl count the cells with bla in the D column(4 in this exemple). Sorry if I'm not really clear but if you can help me feel free t answer :) thx, Tulkas -- Tulka -----------------------------------------------------------...

Excel 'hangs' when deleting a row
when i delete a row in excel 2000, everything locks up! and when lookup at Task Manager/Processes, it's MEM USAGE goes up to 22K o more! i tried doing it in another file but i experienced no error. the dat is in LAN. all data are filtered when the deletion began. however i ca delete files before. please help, anyone.... -- Message posted from http://www.ExcelForum.com The best thing is to free up memory (assuming your file is large). Clos all applications you do not require at the time and any workbooks no in use. Dunca -- Message posted from http://www.ExcelForum.com ...

Using a VBscript to copy/delete/move Outlook messages
I need to write a VBscript to: - open my Outlook (2000 or XP) mailbox - read the list of the folders in either the Exchange Mailbox and in local ..pst files - open each folder and subfolders - read information about messages (i.e. sender, recipient, creation date, and so on) - move, copy or delete messages based on the above information Can anybody please provide a pointer to a sample I can start from? Regards Marius ...

IE8 was deleted from my windows 7 and I cannot find correct downlo
I have a two month old Toshiba and deleted IE8 because of crashes. Trying to find the correct download to reinstall. The IE8 homepage just says it is included in windows 7 but does not show the download file....... ARRRG. Tried Vista IE8 download file but message says it not the correct operating system. On Sun, 21 Mar 2010 20:50:01 -0700, pawntonian <pawntonian@discussions.microsoft.com> wrote: >I have a two month old Toshiba and deleted IE8 because of crashes. Trying to >find the correct download to reinstall. The IE8 homepage just says it is >included in wind...

Problems with german characters (umlaute)
Hello colleagues, it happes every months that a mail reaches us with I don't know how coded german characters. Our german customers are calling us, asking what we're missing on our system. I've checked one of these mails and the only thing I found out that the codepage, which was specified in the header, was the same than in the other mails I've in my mailbox and which I can read perfectly. The strange thing in current case is, that the email is displayed correctly when the mail is opened in Outlook Web Access. I need some help how to get hand on these problems. Many...

How to delete duplicate data
Hi, I am using excel to consolidate monthly room booking data. I have a date column and time column. May I know how to to delete those rows which contains duplicate data with same date stated in the date columnand and same time range in the time column? Thank you. Data>filter>advanced filter, unique records only and copy to another location -- Regards, Peo Sjoblom Excel 95 - Excel 2007 Northwest Excel Solutions www.nwexcelsolutions.com (Remove ^^ from email) "PL" <PL@discussions.microsoft.com> wrote in message news:F45DAE2B-252D-4E17-81D8-0F4C060BCB21@m...

select database
Hi all Prob an easy one but is there a keyboard shortcut to select a whole range of data (database) in excel. Or select just the filled in data. I know ctrl A selects all - is there a variation on this? any help greatly appreciated cheers Rexmann Hi Rexmann You can use Ctrl * to select the current region -- Regards Ron de Bruin http://www.rondebruin.nl "rexmann" <rexmann@discussions.microsoft.com> wrote in message news:019FE07A-9C7D-4300-9137-646406AAAA48@microsoft.com... > Hi all > > Prob an easy one but is there a keyboard shortcut to select a whole range ...

Can you delete and empty an open email
Hi there Can you delete and empty an open email? I know I can delete and empty a closed email by holding down shift and then deleting, but have not been able to figure out how to delete and empty from an open email. Is this even possible? Thanks for your help. Kylie On Wed, 18 May 2005 20:01:03 -1000, Kylie B"" <KylieB@discussions.microsoft.com> wrote: > Hi there > > Can you delete and empty an open email? I know I can delete and empty a > closed email by holding down shift and then deleting, but have not been > able > to figure out how to delet...

Automatically generate a new record
Can I autumatically generate a new record adding information (future date) from a current record? Yes. In your form have Double-click event call an append query that pull data from your form fields to append one record. INSERT INTO [YourTableToAppendInto] ( Field1, Field2, Field3, Field4 ) SELECT TOP 1 [Forms]![YourForm]![1stField] AS [X], [Forms]![YourForm]![2ndtField] AS [Y], [Forms]![YourForm]![2rdtField] AS [Z], [Forms]![YourForm]![4thtField] AS [A]; -- KARL DEWEY Build a little - Test a little "Crown Jenny" wrote: > Can I autumatically generate a new record addin...

Restore messages from Exchange database
Our SBS2000 crashed the other day without a backup of Active Directory. We now only have a backup of the exchange database (edb and stm files). The domain has been recreated from fresh and 5 computers were re-joined the domain. Exchange also were installed. Question: what would be the right way to restore the messages from the edb and stm backup copy? Thank you in advance! -jesk Jesk You'll have to recreate the Exchange org and do a restore. http://www.microsoft.com/technet/prodtechnol/exchange/2003/library/disrecopgde.mspx Unless you have a flat file recovery tool like Quest R...

countif problem.
I wrote a formula in a cell that contains the following: =countif(f5:f268,"> char(32)") / countif(e5:e268,"> char(32)") I have verified that any unused cells have blanks spaces in them. Both columns have data in the same rows so the counted value for each column should be the same but it isnt. All cells contain only numbers or letters and the cells format is general. Any suggestions?? Not sure I get it, but try =countif(f5:f268,">"&char(32)) / countif(e5:e268,">"&char(32)) "psion" <oregonsparkie@hotmail.com> w...

deny ability to delete sent items
Environment is Win2k3 Server and Exch2k3. We would like to impliment a Group Policy that would remove users ability to delete the items in their Sent Items folder. It would be OK if items could be removed after Archiving if necessary. It appears that deleted Sent Items do not go to Deleted Items folder, so dumpster retention policy doesn't seem to be a solution. Any ideas? I am 99.9% certain that this is not possible through group policy. I'm very certain that while it might be possible, it would be extremely difficult to implement and manage. -- Ed Crowley MVP - Exchange &quo...

Carriage Return/Line Feed Problem
Hi guys, I wrote some code that gets the HTML from a Web page and stores it in a buffer, then I display the buffer in a big multiline CEdit box. The problem is that on many pages I don't get new lines, I just get a thick solid verticle line kinda like this: || where it should return. Also, if I view the pages (view source) in Notepad they look fine. Most pages do that, but interestingly Microsoft pages do the proper new line and look great in my edit box. Maybe I have to replace all the \r with \r\n or something like that ? Does a \r\n still only take up 1 char ? I download the page in...

Problem with printing listbox bigger than one page
Hi, I created form "Invoice". It contains few list boxes (like: Brand, Product, Price, etc.). Each list box is big enough to display 50 items. It works in this way: user is chosing product from table Products_tbl and clicks on "Add to invoice" button which adds to each list box new item containg apropriate information about chosen product. At the end, user can print the form. Before it was limited, and user could put max. 50 products on one invoice, but I wanted to get rid of this limitation. I did it in this way: after 50th item, with each added product I extend list boxe...

Audience rule, problem with Domain Local Group.
I try to create a rule for my audience on Portal 2007 User = Member of --- some Domain Local Group (I need to add people from other trusted forest) But it can't be relolved :-( What's wrong? I checked it on 3 Portals, no luck I cam only create such a rule: Work e-mail Contains @needed_domain.com or add individual accounts from those domains, but there are 1000, too hard to add manually .... Please help. Perhaps there is another way These groups need to be either Global or Universal groups. Universal groups are better for SharePoint, and they can contain global...