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.
12 17560
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.
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 -
Private Sub Save_Button_Click()
-
On Error GoTo Err_Save_Button_Click
-
-
Dim MyDB As Database, MyTable As Recordset
-
Set MyDB = DBEngine.Workspaces(0).Databases(0)
-
-
Dim MyTable4 As Recordset
-
Set MyTable4 = MyDB.OpenRecordset("Tax Map")
-
MyTable4.Index = "PrimaryKey"
-
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]
-
Do Until MyTable4.EOF Or MyTable4.NoMatch
-
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
-
MyTable4.Edit
-
MyTable4![Title Opinion #] = Me![Add Tax Map Info SubForm].Form![Title Opinion #]
-
MyTable4.Update
-
Exit Do
-
Else
-
MyTable4.MoveNext
-
End If
-
Loop
-
-
Set MyTable = MyDB.OpenRecordset("Interested Parties")
-
'Stop
-
MyTable.AddNew
-
MyTable![LEASE NUMBER] = Forms![LEASE DATA COPY FORM ONLY]![LEASE NUMBER]
-
MyTable![SURFACE#] = "S0000"
-
MyTable![Division#] = Me![Division]
-
MyTable![Last Name] = Me![Last Name]
-
MyTable![First Name] = Me![First Name]
-
'other things are the same way
-
MyTable.Update
-
-
'SAVE INFORMATION TO THE "INTERESTS/TAX MAP" TABLE FROM THE "NEW INTEREST TAX MAP SETUP" TABLE
-
Dim MyTable2 As Recordset, MyTable3 As Recordset
-
Set MyTable2 = MyDB.OpenRecordset("Interest/Tax Map")
-
Set MyTable3 = MyDB.OpenRecordset("New Interest Tax Map Setup")
-
Do Until MyTable3.EOF
-
MyTable3.MoveFirst
-
Do Until MyTable3.EOF
-
If IsNull(MyTable3![State Code]) Then
-
MyTable3.MoveNext
-
Else
-
MyTable2.AddNew
-
MyTable2![LEASE NUMBER] = MyTable3![LEASE NUMBER]
-
MyTable2![SURFACE#] = "S0000"
-
MyTable2![Division#] = MyTable3![Division#]
-
MyTable2![State Code] = MyTable3![State Code]
-
'skip other things
-
MyTable2.Update
-
MyTable3.MoveNext
-
End If
-
Loop
-
-
'DELETE ALL RECORDS FROM THE "NEW INTEREST TAX MAP SETUP TABLE
-
MyTable3.MoveFirst
-
Do Until MyTable3.EOF
-
MyTable3.Delete
-
MyTable3.MoveNext
-
Loop
-
Loop
-
DoCmd.SetWarnings False
-
'SAVE RECORDS FROM THE "TAX MAP/UNITS Temp" TABLE TO THE "TAX MAP/UNITS" TABLE
-
Dim stDocName As String
-
stDocName = "Append to Tax Map/Units Table"
-
DoCmd.OpenQuery stDocName, acNormal, acEdit
-
'DELETE RECORDS FROM THE "TAX MAP/UNITS Temp" TABLE
-
stDocName = "Delete Tax Map/Units Temp Table"
-
DoCmd.OpenQuery stDocName, acNormal, acEdit
-
-
'SAVE RECORDS FROM THE "TAX MAP/PROSPECTS Temp" TABLE TO THE "TAX MAP/PROSPECTS" TABLE
-
stDocName = "Append to Tax Map/Prospects Table"
-
DoCmd.OpenQuery stDocName, acNormal, acEdit
-
'DELETE RECORDS FROM THE "TAX MAP/PROSPECTS Temp" TABLE
-
stDocName = "Delete Tax Map/Prospects Temp Table"
-
DoCmd.OpenQuery stDocName, acNormal, acEdit
-
-
DoCmd.SetWarnings True
-
DoCmd.Close
-
-
Exit_Save_Button_Click:
-
Exit Sub
-
-
Err_Save_Button_Click:
-
MsgBox Err.DESCRIPTION
-
Resume Exit_Save_Button_Click
-
-
End Sub
-
Thanks.
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
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.
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
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
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
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.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Thank you much
End If
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.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
This says if changes have been made then save the record. However, this won't work on an unbound form.
Hi
I have just the same error message in similar circumstances; forms that run ok in '97 but error after conversion to 2002/3, so thought I'd add to this thread.
My situation is that after opening the [Sales Order History] listing form the user can pop-open the main [Sales Orders] in READ ONLY format which is when the error occurs. Microsoft's reason is ;-
"Access 2000 only looks at the AllowEdits property when making this determination, when it should be looking at both the AllowEdits and the AllowAdditions properties." - kb 280521 (similar but not same problem)
Microsoft's recommendation was to load latest Service Pack but that did not work for me so I changed the code as below. - stDocName = "SalesOrders"
-
stCalledFrom = "Previous"
-
stLinkCriteria = "[OrderID]=" & Me![OrderID]
-
-
DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormReadOnly, acDialog
-
-
'change last line to
-
DoCmd.OpenForm stDocName, , , stLinkCriteria, , acDialog
I tried to hold off the save if nothing had changed with ;- - If Me.Dirty Then DoCmd.RunCommand acCmdSaveRecord
but that did not work even though the form itself should not have been 'dirty'. When witing the code I think I had to force a 'save' to keep various audit functions current (because it is some years since I wrote this)
S7
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.
I have the same problem with some of my forms. I'm using the same form for Adding / Editing / Viewing records with subforms on a tab control. The subforms are linked to different tables that link back to the main table. The save command has to be in there for when adding new records so that records don't get saved into the tables without the the main table being saved.
I just got around the problem by trapping the error.
Public Sub (YourSubName)
On Error GoTo ErrPoint
Your code goes here
ExitPoint:
Exit Sub
ErrPoint:
If Err.Number = 2046 Then
Resume Next
Else
MsgBox "Error# " & err.number & " " & Err.Description
Resume ExitPoint
End If
You can use whatever code you want in place of the MsgBox, I personally call my own error traping sub form there that places all the error information into a table so I can use it for debuging later.
Don
I was running into the same issue.
I think I've figured it out. At least for me. I did a quick check and it seems that if your FORM is going after more than 1 table it doesn't know where to save the info. So I'm trying a work around. Creating a table with all data fields active with no links or relationships.
Hope it works for you guys too.
~Bill
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
| |