473,508 Members | 3,688 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 5063
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=False, 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
8468
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...
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...
4
6681
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
1995
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...
5
1868
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...
8
3611
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...
3
2544
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...
25
20505
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,...
0
1166
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...
0
7228
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7128
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...
0
7332
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,...
0
7393
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7058
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...
0
5635
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,...
1
5057
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...
0
4715
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...
1
769
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.