473,666 Members | 2,367 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

error "The command or action 'SaveRecord' isn't available now"

6 New Member
I converted Acc97 to Acc2003 and got this error "The command or action
'SaveRecord' isn't available now" when i tried to open one form"Add
Info form", which has Save button. I checked "reference" in Tool to
see DAO 3.6 object library setting, and it was right.
How can i resolve this error?
Thanks.
Mar 29 '07 #1
12 17602
MMcCarthy
14,534 Recognized Expert Moderator MVP
I converted Acc97 to Acc2003 and got this error "The command or action
'SaveRecord' isn't available now" when i tried to open one form"Add
Info form", which has Save button. I checked "reference" in Tool to
see DAO 3.6 object library setting, and it was right.
How can i resolve this error?
Thanks.
What code exactly are you using on the save record button.
Mar 29 '07 #2
ilucks
6 New Member
What code exactly are you using on the save record button.
Clickevent and commandbutton - Save button

where can i add this line in the code?
If Me.Dirty Then RunCommand acCmdSaveRecord

Expand|Select|Wrap|Line Numbers
  1. Private Sub Save_Button_Click()
  2. On Error GoTo Err_Save_Button_Click
  3.  
  4.   Dim MyDB As Database, MyTable As Recordset
  5.   Set MyDB = DBEngine.Workspaces(0).Databases(0)
  6.  
  7.     Dim MyTable4 As Recordset
  8.     Set MyTable4 = MyDB.OpenRecordset("Tax Map")
  9.     MyTable4.Index = "PrimaryKey"
  10.     MyTable4.Seek ">=", Me![Add Tax Map Info SubForm].Form![State Code], Me![Add Tax Map Info SubForm].Form![COUNTY CODE], Me![Add Tax Map Info SubForm].Form![TOWNSHIP CODE], Me![Add Tax Map Info SubForm].Form![Tax Map], Me![Add Tax Map Info SubForm].Form![Alternate ID]
  11.     Do Until MyTable4.EOF Or MyTable4.NoMatch
  12.     If MyTable4![State Code] = Me![Add Tax Map Info SubForm].Form![State Code] And MyTable4![COUNTY CODE] = Me![Add Tax Map Info SubForm].Form![County] And MyTable4![TOWNSHIP CODE] = Me![Add Tax Map Info SubForm].Form![Township] And MyTable4![Tax Map] = Me![Add Tax Map Info SubForm].Form![Tax Map] And MyTable4![Alternate ID] = Me![Add Tax Map Info SubForm].Form![AltID] Then
  13.         MyTable4.Edit
  14.         MyTable4![Title Opinion #] = Me![Add Tax Map Info SubForm].Form![Title Opinion #]
  15.         MyTable4.Update
  16.         Exit Do
  17.     Else
  18.         MyTable4.MoveNext
  19.     End If
  20.     Loop
  21.  
  22.   Set MyTable = MyDB.OpenRecordset("Interested Parties")
  23. 'Stop
  24.     MyTable.AddNew
  25.         MyTable![LEASE NUMBER] = Forms![LEASE DATA COPY FORM ONLY]![LEASE NUMBER]
  26.         MyTable![SURFACE#] = "S0000"
  27.         MyTable![Division#] = Me![Division]
  28.         MyTable![Last Name] = Me![Last Name]
  29.         MyTable![First Name] = Me![First Name]
  30.         'other things are the same way
  31.     MyTable.Update        
  32.  
  33. 'SAVE INFORMATION TO THE "INTERESTS/TAX MAP" TABLE FROM THE "NEW INTEREST TAX MAP SETUP" TABLE
  34.     Dim MyTable2 As Recordset, MyTable3 As Recordset
  35.     Set MyTable2 = MyDB.OpenRecordset("Interest/Tax Map")
  36.     Set MyTable3 = MyDB.OpenRecordset("New Interest Tax Map Setup")
  37.     Do Until MyTable3.EOF
  38.     MyTable3.MoveFirst
  39.         Do Until MyTable3.EOF
  40.         If IsNull(MyTable3![State Code]) Then
  41.             MyTable3.MoveNext
  42.         Else
  43.  MyTable2.AddNew
  44.             MyTable2![LEASE NUMBER] = MyTable3![LEASE NUMBER]
  45.             MyTable2![SURFACE#] = "S0000"
  46.             MyTable2![Division#] = MyTable3![Division#]
  47.             MyTable2![State Code] = MyTable3![State Code]
  48.             'skip other things 
  49.             MyTable2.Update
  50.             MyTable3.MoveNext
  51.         End If
  52.         Loop 
  53.  
  54. 'DELETE ALL RECORDS FROM THE "NEW INTEREST TAX MAP SETUP TABLE
  55.     MyTable3.MoveFirst
  56.     Do Until MyTable3.EOF
  57.         MyTable3.Delete
  58.         MyTable3.MoveNext
  59.     Loop
  60.     Loop
  61.  DoCmd.SetWarnings False
  62.  'SAVE RECORDS FROM THE "TAX MAP/UNITS Temp" TABLE TO THE "TAX MAP/UNITS" TABLE
  63.     Dim stDocName As String
  64.     stDocName = "Append to Tax Map/Units Table"
  65.     DoCmd.OpenQuery stDocName, acNormal, acEdit
  66.  'DELETE RECORDS FROM THE "TAX MAP/UNITS Temp" TABLE
  67.     stDocName = "Delete Tax Map/Units Temp Table"
  68.     DoCmd.OpenQuery stDocName, acNormal, acEdit
  69.  
  70. 'SAVE RECORDS FROM THE "TAX MAP/PROSPECTS Temp" TABLE TO THE "TAX MAP/PROSPECTS" TABLE
  71.     stDocName = "Append to Tax Map/Prospects Table"
  72.     DoCmd.OpenQuery stDocName, acNormal, acEdit
  73. 'DELETE RECORDS FROM THE "TAX MAP/PROSPECTS Temp" TABLE
  74.     stDocName = "Delete Tax Map/Prospects Temp Table"
  75.     DoCmd.OpenQuery stDocName, acNormal, acEdit
  76.  
  77. DoCmd.SetWarnings True
  78. DoCmd.Close
  79.  
  80. Exit_Save_Button_Click:
  81.     Exit Sub
  82.  
  83. Err_Save_Button_Click:
  84.     MsgBox Err.DESCRIPTION
  85.     Resume Exit_Save_Button_Click
  86.  
  87. End Sub
  88.  
Thanks.
Mar 30 '07 #3
MMcCarthy
14,534 Recognized Expert Moderator MVP
Clickevent and commandbutton - Save button

where can i add this line in the code?
If Me.Dirty Then RunCommand acCmdSaveRecord
I'm not sure what you mean. The code you have given uses recordsets to save data. The line of code above would save a record if any changes had been made on a form. However, this would happen automatically on a bound form.

Mary
Apr 1 '07 #4
ilucks
6 New Member
Thank you for your tip.

I have a few more questions about it.
As i mentioned before, i converted this DB to access 2002 and tried to open an unbound form from the bound form.
so like this. I have
1. open a bound form A ( Customer)
2. enter a customer number and click Add info button,which is an unbound form to add more information. Here is the problem occurred.
It says error "The command or action 'SaveRecord' isn't available now"
can you tell me about more how this happenning in the bound or unbound form?
you're saying that the code in Add Info form(unbound) shouldn't cause this error.
what about in Form A? by the way, a user
why does this happen?
how does a subform work after the conversion?
i just noticed that a subform(bound form) in Form A displays just like a normal form. In other words, i checked the properties of this subform and it doesn't say subform propeties.just says "Form".



i am a beginner in access programming.
I would appreciaste your help.
Apr 2 '07 #5
MMcCarthy
14,534 Recognized Expert Moderator MVP
Bound forms are bound to a table or query and will save records and changes to records directly to the tables. An unbound form is just a visual graphic. The data is only held as long as the form is open.

You have tried to get around this by adding the data via recordsets but if you are trying to tie that new record in the bound form then this won't work as this record is not yet saved.

Why is the second form unbound?

Using subforms there is a Form that the object is based on and a subform object which is the object on the Main Form.

Mary
Apr 2 '07 #6
ilucks
6 New Member
Bound forms are bound to a table or query and will save records and changes to records directly to the tables. An unbound form is just a visual graphic. The data is only held as long as the form is open.

You have tried to get around this by adding the data via recordsets but if you are trying to tie that new record in the bound form then this won't work as this record is not yet saved.

Why is the second form unbound?

Using subforms there is a Form that the object is based on and a subform object which is the object on the Main Form.

Mary
Why is the second form unbound?
it was like this before i came to work here..
When does this error happen?
The DB in access 97 works fine, but not the converted one, why?
I checked other forms and they just display data.
This is the only form has a savebutton but you told me the code uses recordset to save data. where else do i have to check?

thanks
Apr 2 '07 #7
MMcCarthy
14,534 Recognized Expert Moderator MVP
What the unbound form is doing is not incorrect but it's very difficult to guide you through a conversion as your knowledge of VBA is limited.

There is no save command as such in this code which means the error is probably referring to one of the recordset update commands. I don't know why it's not working as there are many possibilities which could extend to the queries.

When the error comes up, do you get a debug option? If so what line of code does it stop at?

Mary
Apr 2 '07 #8
ilucks
6 New Member
What the unbound form is doing is not incorrect but it's very difficult to guide you through a conversion as your knowledge of VBA is limited.

There is no save command as such in this code which means the error is probably referring to one of the recordset update commands. I don't know why it's not working as there are many possibilities which could extend to the queries.

When the error comes up, do you get a debug option? If so what line of code does it stop at?

Mary
No, i didn't get the debug option.
In the bound form(Form A), i get this message when i click Add Info button.
By the way, i found out that this Add Info form has two bound forms associated with.lol
Again,
1. i open Form A(the bound form)
2. click Add Info button to add additional info - i get an error message
what is If Me.Dirty then Me.Dirty = false
when can i use and how?
What is this?
If Me.Dirty Then
DoCmd.DoMenuIte m acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

Thank you much
End If
Apr 2 '07 #9
MMcCarthy
14,534 Recognized Expert Moderator MVP
No, i didn't get the debug option.
In the bound form(Form A), i get this message when i click Add Info button.
By the way, i found out that this Add Info form has two bound forms associated with.lol
Again,
1. i open Form A(the bound form)
2. click Add Info button to add additional info - i get an error message
what is If Me.Dirty then Me.Dirty = false
when can i use and how?
This clears the form of any new or edited data.

What is this?
If Me.Dirty Then
DoCmd.DoMenuIte m acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
This says if changes have been made then save the record. However, this won't work on an unbound form.
Apr 2 '07 #10

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

Similar topics

16
2443
by: Jim Hefferon | last post by:
Hello, I'm getting an error join-ing strings and wonder if someone can explain why the function is behaving this way? If I .join in a string that contains a high character then I get an ascii codec decoding error. (The code below illustrates.) Why doesn't it just concatenate? I'm building up a web page by stuffing an array and then doing "".join(r) at
8
11227
by: RC | last post by:
In my Access 2002 form, I have a combo box and on the AfterUpdate event I use DoCmd.RunSQL ("UPDATE .... to update records in a table. When it starts to run I get a message "You are about to update 3 row(s)." Is there a way to prevent the message from popping up?
0
4007
by: Susan Bricker | last post by:
What possible situations (or set of variables) could cause the following error: "The command or action 'DeleteRecord' isn't available now." Error Number = 2046. The routine that gets the error is (comments left in to show various solutions that all get the same results (error message above):
5
2542
by: Stan | last post by:
When I create a Web project and then try to add the files to it (Add Existing Item), I get this error message "The folder http://localhost/FinWeb is no longer availabe" In fact the folder and the virtual directory FinWeb both exist and project compiles just fine, but I cannot add the existing files to it. If I create a project with a different name (FinWeb2) it works fine.
1
2009
by: Elie | last post by:
Hello I get this error when the code runs from the server as an .asp page or from a compiled dll. But When I log onto the server and run a vb program that executes the same code, it works fine. this works fine on a different web server as well. They are both running windows 2003.
9
6153
by: Martin Eyles | last post by:
Hi, I have set up an asp.net website on another PC in order to test it. The site was fine on my PC, but on the new PC all the pages give the error "The Page Cannot Be Found". Some legacy pages (ASP, as opposed to ASP.Net) work fine. The old PC was running Windows 2000 Server, and the new PC I am testing on is running Windows Server 2003. Thanks in advance,
0
3386
by: Curious | last post by:
Hi, I'm not sure if this is the right place to post such command issues. If you know a better forum where people respond to messages fairly often, please let me know! Anyway, would appreciate your help! --------------------------------------------------------------------------------------------------------------- Hi, I've created a scheduler job with FORFILES command to delete files
1
20206
by: LiveCycle | last post by:
Hi, I've got a longstanding project that's been working fine for about a year. I was working on one of the pages, a simple download page. After making a little tweak on the page, I tried to re-run the project and got the error: The server block is not well formed. Page: FileDownload.aspx, line 23935. Now, there are only about 50 lines on this page, so something's off. I've tried rebooting. I've tried Rebuild Solution. I've...
15
14738
by: Kurda Yon | last post by:
Hi, I try to "build" and "install" pysqlite? After I type "python setup.py build" I get a lot of error messages? The first error is "src/ connection.h:33:21: error: sqlite3.h: No such file or directory". So, I assume that the absence of the "sqlite3.h" is the origin of the problem. I found on the web, that this file should be either in "/usr/local/ include" or in "/usr/local/lib". I check this directories and I really
0
8352
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
8863
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...
0
8780
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8549
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
8636
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7378
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
6189
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...
1
2765
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2005
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.