473,654 Members | 3,115 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

"'Save Record' not available" error

jmoudy77
20 New Member
Hi, I've got a form that allows a user to imput their flight data. I programmed a MsgBox into the save button that asks if the user wants to input another duty position for the flight.

If no, the record saves and the formresets for the next rocord input.

If yes, the record is saved and the duty position and mode of flight fields are set to null, with the remainder of the fields retaining the data already entered.

The problem is that when I press save again, the message box appears, and when I press yes or no I get the 'Save Record' not available error message.

Code attached. Any ideas?

Expand|Select|Wrap|Line Numbers
  1. Private Sub Command38_Click()
  2. On Error GoTo Err_Command38_Click
  3.  
  4.     Response = MsgBox("Add another duty position?", 4)
  5.         If Response = 7 Then
  6.             DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
  7.             DoCmd.GoToRecord , , acNewRec
  8.         Else
  9.             DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
  10.             [PI] = Null
  11.             [PC] = Null
  12.             [IP] = Null
  13.             [SP] = Null
  14.             [IE] = Null
  15.             [MTP] = Null
  16.             [Daytime] = Null
  17.             [Night] = Null
  18.             [NVG] = Null
  19.             [Hood] = Null
  20.         End If
  21.  
  22. Exit_Command38_Click:
  23.     Exit Sub
  24.  
  25. Err_Command38_Click:
  26.     MsgBox Err.Description
  27.     Resume Exit_Command38_Click
  28.  
  29. End Sub
Feb 16 '08 #1
8 5073
sierra7
446 Recognized Expert Contributor
Hi Scott
Are you by chance using Access 2003 ???

I've found it very prone to chuck-up this error on code which works perfectly in '97 or 2002.

I have not fully bottomed this out , but in some cases if the record has already been saved it will not allow it to be saved a second time (nothing to save?) other times it "thinks" that Allow_Edits=Fal se, because some form is open in Dialogue mode.

However, in passing, I would mention that the syntax you are using is pre-Access'97 and (unless it has changed again with 2007) the preferred syntax is;-
Expand|Select|Wrap|Line Numbers
  1.  DoCmd.RunCommand acCmdSaveRecord 
but I don't think this will resolve your problem.
On a more personal note, I find
Expand|Select|Wrap|Line Numbers
  1.  Response = MsgBox("Add another duty position?", 4) 
  2. If Response = 7 Then
  3.  
less easy to read than
Expand|Select|Wrap|Line Numbers
  1.  
  2. Response = MsgBox("Add another duty position?", vbYesNo)
  3. If Response = vbNo Then
if I have guessed right, but that is just a matter of preference and will not be the cause of the error message.

If I get time I'll try and set-up a demo and test out your code but I suspect it is more a case of what is open in Access at the time you are trying to Save.

S7
Feb 16 '08 #2
sierra7
446 Recognized Expert Contributor
Hi
I've just re-read your question and I can't understand why you want to "force" a Save in either case.

Access will save automatically on the acNewRecord, so you don't need it there. (Unless you are you using 'Unbound' forms when it won't work anyway)

And I am not too clear why you would want to save on the 'Yes' if the data is incomplete. Why not wait until it is complete? I suspect (and I will have to test this) that if you change the values to Null programatically then the form may not be set to 'Dirty' , so Save may not be available. (having just saved)
Maybe setting
Expand|Select|Wrap|Line Numbers
  1. Me.Dirty = True 
will allow a second save, whether it's needed ot not.
I'm not at my Access2003 machine today but will test on Monday.
S7
Feb 16 '08 #3
jmoudy77
20 New Member
Hi S7,

Scott edited the code tags in for me, thanks Scott.

You hit the nail on the head. The record has already been saved; what I can't figure out is how to have it recognize this as a new record without deleting the information out of all the controls. The only controls I want deleted are the ones I null in the code. Any thoughts?

Thanks
Feb 16 '08 #4
jmoudy77
20 New Member
I don't want it to save an incomplete record. Here's the situation:

An aviator opens the form to log his flight info.
Once he's done and presses the Save cmdbttn, the msgbox appears asking if he wants to add another duty position for this same flight.
If no, the record is saved and the form resets to add a new record.
If yes, the record saves and then clears only the fields he needs to fill for his second duty position, which keeps him from having to re-enter all the other info.
He then saves this and selects No on the msgbox if no other duty position is required to be filed.
Basicly it creates a new record in the table for each duty position he wants to log.

Josh
Feb 16 '08 #5
missinglinq
3,532 Recognized Expert Specialist
I'm heading out the door right now, but I'll look at this further later on today, but one thing that strikes me right off is that your code only shows you moving to a new record once, if you don't want to add another flight position. The way you've described this though, when you add another flight position, you still need to add a new record, just a new record with much of the same data pre-loaded.

In Access you can't simply save a record, delete some of the data from it, then save it again as a new record, like you would a word processor file! The record you're working with is still the original record! You have to move to a new record first, then prefill it with data from the original record, complete it and then save the second record.

Welcome to TheScripts!

Linq ;0)>
Feb 16 '08 #6
missinglinq
3,532 Recognized Expert Specialist
I think this is the sort of thing you need:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Command38_Click()
  2. On Error GoTo Err_Command38_Click
  3.  
  4. Response = MsgBox("Add another duty position?", 4)
  5. If Response = vbNo Then
  6.  
  7. DoCmd.GoToRecord , , acNewRec
  8.  
  9. Else 'Add another flight position
  10.  
  11. 'Assign value of fields you want to carry forward to variables
  12. MyFirstField = Me.FirstField
  13. MySecondField = Me.SecondField
  14. MyThirdField = Me.ThirdField
  15.  
  16. 'Go to a new record
  17. DoCmd.GoToRecord , , acNewRec
  18.  
  19. 'Plug in old values from variables to new record
  20. Me.FirstField = MyFirstField
  21. Me.SecondField  = MySecondField 
  22. Me.ThirdField = MyThirdField 
  23.  
  24. End If
  25.  
  26. Exit_Command38_Click:
  27. Exit Sub
  28.  
  29. Err_Command38_Click:
  30. MsgBox Err.Description
  31. Resume Exit_Command38_Click
  32.  
  33. End Sub
Lines 12-14 copies the value of the fields in the original record that you want to carry forward into the new record into variables.

Line 17 moves to a new record.

Lines 20-22 re-assigns the variables to the fields in the new record. Any fields that haven't been copied in this manner will be empty, awaiting the new data.

Linq ;0)>
Feb 17 '08 #7
sierra7
446 Recognized Expert Contributor
That makes good sense to me Linq!

On the question of differences between 2002 & 2003; have you found that 2003 is more fussy than 2002 in this matter ?

S7
Feb 17 '08 #8
jmoudy77
20 New Member
Thanks Linq, that worked like a charm.
Feb 17 '08 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

5
8478
by: Quinn | last post by:
When users clicked a unkown mime type link such as Zip on my website, a "Save/Open/Cancel" dialog box pops up. Is there a way to detect which button users clicked by using ASP? actually I only what to record the "valid" click -- when Open/Save was clicked. Thanks ahead. Quinn
1
335
by: J. Koskey | last post by:
Background: We have hundreds of codes = specific departments, but there are frequent changes/additions to the info. For users to look up definitions, we had set up a way in Access to create a webpage link for each separate code. Back in an earlier version of Access - 97 or possibly 95 - there was a command of <File><Save as HTML> which let us select *all* of the 350+ queries and go through a wizard to save them all as HTML. Problem:...
4
6686
by: Tim | last post by:
I have used a graphic 'next record' button on a form. How can I stop it from going past the last existing record? In other words, I don't want it to take the user to a blank record. Thanks Tim
1
2001
by: me | last post by:
I'm building a multi user app where many admins will be making calls to people in one table. I want to keep things simple and find a way to prevent 2 or more admins from working on the same record at the same time. In other words I need a way to go the next "available" record. Any help will be greatly appreciated, please reply here in the NG. Thanks in advance !!
5
1876
by: Paul Sullivan | last post by:
We are a state agency that views protected medical information via our intranet. The screens even have privacy shields. Alarmingly, uses can "Print" and "Save As" which destroys the protection of the health information at the level we want. QUESTION: Can we shut those off?? Any other suggestions?? Paul Sullivan
8
3621
by: asenthil | last post by:
Hai to all, if i'm having a file named as "tab.doc" which is a microsoft word document file ... i want to save it as another file as "tab1.doc" by using "save as" method.... Is there any "save as" method available for doing this process in VC++....
3
2560
by: anudu | last post by:
hi, I am developing a system with asp.net, c#, and ajax. I have an excel file in server in "Server.MapPath("ExcelFiles/Test.xls")". I want to make it available to save to the disk in client side. I hope save file dialoge box will allow to do this. How can i do this? thanks
25
20546
by: tekctrl | last post by:
Anyone: I have a simple MSAccess DB which was created from an old ASCII flatfile. It works fine except for something that just started happening. I'll enter info in a record, save the record, and try to move to another record and get an Access error "Record is too large". The record is only half filled, with many empty fields. If I remove the added data or delete some older data, then it saves ok and works fine again. Whenever I'm...
0
1177
by: Edwin.Madari | last post by:
since choice of dbm used by shelve http://docs.python.org/lib/node327.html depends on os, and whats available on it, shevle files saved on one os, most likely do not work on another os, sometimes on similar os but different machines might not work either - goes back to what's available on that machine. inter operability of shelve files with similar os-es works! yes I had used it. For inter-operability of saved information across os-es,...
0
8290
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8815
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8489
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7307
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6161
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5622
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4294
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1916
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1596
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.