"Action cannot be performed"

I got an access application running, the users are redirected to the different forms through a menu...

When a user opens a form and closes it again, the form is simply made invisible but is not 'closed' so to speak, when the user clicks the specific menu item again, the menu is shown again...

Now sometimes after some time a user gets "Action cannot be performed" each time he clicks one of the menu items, no matter which one, and access needs to be closed with ctrl-alt-del and reopenend before he can continue to use the application

The onClick procedure has the following code:

	Code:
	Private Sub CMDOpenBestelbon_Click()
On Error GoTo Err_CMDOpenBestelbon_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "Bestelbon"
    
    DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_CMDOpenBestelbon_Click:
    Exit Sub

Err_CMDOpenBestelbon_Click:
    MsgBox Err.Description
    Resume Exit_CMDOpenBestelbon_Click
    
End Sub

What causes this and how can I solve it?
Is it the fact that the forms aren't closed (but made invisible) and reopened with DoCmd.OpenForm ? (I doubt it as most of the time opening & reopening all works fine) ...


Plz help

TIA


Post your answer or comment

comments powered by Disqus
Hi everyone. I've done a lot of VBA in Excel programming, but not a lot in Access. Hopefully this problem has a simple fix but so far the solution has eluded me.

General situation: My company stores data in different sources (Oracle, SQL Server, Excel, and Access). For lack of a better word, we'll say the region to which the data apply determines the program where the data is stored. This is a situation that isn't going to change. I've been tasked with creating a database that will talk to the different systems. The user needs to be able to select the region on the form and then the program will go retrieve data from the appropriate system. The user can then generate reports based on the retrieved data.

What I've done so far: I have the form built in an Access database (DB1) and am adding code behind it. It talks to Excel and SQL successfully. Here's where it gets weird. The way I'm trying to implement the Oracle part is by having it interact with another Access database (DB2) that was built specifically for that purpose. DB2 has about 20 linked tables from Oracle and about 40 queries that run off these tables to summarize data into tables. It also has a macro that runs the ~40 queries in order. What I'm doing at the moment is opening DB2 from DB1 and calling the macro that runs the ~40 queries. The final query creates a table in DB2. This table is also a linked table in DB1 and the last thing my code does is refresh the link to this table.

My problem: When I call the routine, the macro running in DB2 takes so long to run that I get an error in DB1 saying, "This action cannot be completed because the other application is busy. Choose " switch to " to activate the busy
application and correct the problem " The user then has to select: [Switch to] [Retry] or [Cancel] before the program will keep going.

My question: How do I prevent this and keep the macro running with focus staying on or returning to DB1 when the macro is done?

To be fair, running the macro directly in DB2 takes about 45 minutes(!). As long as I hit [Switch to], then it takes about the same amount of time when calling it from DB1.

Here's some code to show how I'm implementing this stuff. It's being from run DB1, so the current database is DB1:


	Code:
	Dim accDB As Access.Application
Set accDB = New Access.Application
Dim InvDB As DAO.Database
Dim strDbName As String
Dim tdf As TableDef

' Open DB2:
strDbName = "C:pathDB2.mdb"
accDB.Visible = True
Set InvDB = accDB.DBEngine.OpenDatabase(strDbName, False, False)
accDB.OpenCurrentDatabase strDbName

' Refresh Oracle linked tables in DB2:
For Each tdf In InvDB.TableDefs
    If Len(tdf.Connect) > 0 Then tdf.RefreshLink
Next tdf

' Call Macro to run ~40 queries in DB2:
accDB.DoCmd.SetWarnings False
accDB.DoCmd.RunMacro "mcrRun40Queries"   '

I have a database which emails a task to whoever it is allocated to. This application works fine when using local access, but when i have tried running it as a published application through citrix it generates 2 different errors:

One says:
"Internal Application Error"

The other says:
"The task "Task Name" is stored as a file, not as an item in an Outlook Folder, so the requested action cannot be performed."

Outlook is open on both occurances.

Any ideas on how to solve the problems or what the error messages mean would be greatly appreciated.


Here's our test code that we are using:

Private Sub CmdSend_Click()
On Error GoTo Err_Handler

Dim NameSpace As Object
Dim EmailSend As TaskItem 'for the task item add outlook reference
Dim EmailApp As Object


Set EmailApp = CreateObject("Outlook.Application") 'Outlook object
Set NameSpace = EmailApp.getNameSpace("MAPI")
Set EmailSend = EmailApp.CreateItem(3) ' CreateItem(3) Task Item

EmailSend.Subject = "Task Name" 'Task Subject

EmailSend.Body = "Test Body" 'Task body

EmailSend.Recipients.Add Me![Fixer]
EmailSend.Assign 'to the recipient
EmailSend.Send

MsgBox "Message has been sent successfully"
Exit Sub

Err_Handler:
MsgBox Err.Description


End Sub

See attached query.

The inner SELECT works fine as a standalone query, but when wrapped in the outer SELECT, I get the error "An action query cannot be used as a row source."

I'm running this query on an MDB file from C#.Net, but I get the same results if I copy and paste it into Access 2003 SQL view - there too the inner SELECT works fine, but doesn't work when I wrap it in the outer select. I've also tried removing the final WHERE clause (i.e. the outer WHERE clause) but in all cases, I get the same error message every time I use an outer SELECT.

Hey guys, having a problem. I have a Select query. If I open the query in design mode, change it to an Append query, enter the table to append to and run it, it works fine.

However, if I save the query then close it, and run it again I get this error message:

"An action query cannot be used as a row source"

If I go back and change it to Select query again, close it, open it, change it to Append it works again. I'm really confused as to whats going on to cause this. Any ideas?

Using Access 2010, I split my database and it appears to respond much quicker on my network.

One issue I just found though, after testing it further, is now the 'comment field' gives an error when you try to add a comment.

The data macro 'Comments.AddComment' cannot be found.

I'm guessing that because the table is in the backend and so is the macro, therefore the frontend can't find it. I have read that data macros are not supported with linked tables.

Can anyone knowledgeable in this area suggest an alternative method to re-enable my comments?

The database I'm using is the contacts web database template provided by MS in Access 2010, though I have converted the web database to a standard database.

If this cannot be done, please suggest ways to gain performance over a network and decrease the many error messages that report the database is locked when accessed by multiple users (typically only 3 users).

Thanks
Mike

I designed a report and saved it in my database and when I tried to reopen it, I got this message - "This object was saved in an invalid format and cannot be read." I had saved it before without this problem. Sadly, I did not back this report up before the error occurred. Is there any way to retreive the lost report?

i have created a report with various calculations adding total hours etc. My problem is that when i try to create a calculation at the bottom of the report summarizing the totals for these fields I get the error message "Subqueries cannot be used in the Expression (Sum([Hours Outstanding])). Im assuming it is because I am trying to summarize fields that already contain a calculation but I have no idea how to get around this.

Can anyone help

I have a form with a button which calls a macro to open a query that performs a single record append into a table. The table has a field that is indexed and does not allow duplicates.
I want to add the following to the macro: Set warnings off to eliminate all the message boxes that pop up--1 to inform that an action is being taken, 1 to inform that 1 record is being appended and 1 with very confusing text to inform the action cannot be taken if the record is already in the table. TMI and potentially confusing.
After setting warnings off I want to provide a message box that informs 'Item is Already in table' if the record exists in the table or a message box that informs '1 record has been added' if a record does not exist in the table.
I know this can't be all that difficult. I just can't get the sequencing right.
Help, please

Teh code below is used for doing a mail merge. It works well the 1st time but spits out an error that the database cannot be found when invoked the 2nd time.

Why would this be happening ?


Quote: Public Function LTRCOL_letter()
Dim oMainDoc As Word.Document
Dim oSel As Word.Selection
Dim sDBPath As String

Set oApp = CreateObject("Word.Application")

If oMainDoc Is Nothing Then
Set oMainDoc = oApp.Documents.Open("C:Documents and SettingsChrisDesktopLetter_AccessTemplatesLTR COL.doc")
End If
oApp.Visible = False 'set connection as visible

With oMainDoc.MailMerge
.MainDocumentType = wdFormLetters
sDBPath = AssignDbPath

.OpenDataSource Name:=sDBPath, _
ConfirmConversions:=False, _
ReadOnly:=False, _
LinkToSource:=True, _
AddToRecentFiles:=False, _
Revert:=False, _
Format:=wdOpenFormatRTF, _
Connection:= _
"Provider=Microsoft.ACE.OLEDB.12.0; " & _
"User ID=Admin;" & _
"Password='';" & _
"Data Source=" & sDBPath & ";" & _
"Mode=Read;", _
SQLStatement:="SELECT * FROM `" & "LTRCOL" & "`", SQLStatement1:="", _
Subtype:=wdMergeSubTypeAccess
End With

If oMainDoc.MailMerge.DataSource.RecordCount > 0 Then
Call cmdGo_Click(oMainDoc.MailMerge.DataSource.RecordCo unt)
With oMainDoc
.MailMerge.Destination = wdSendToNewDocument
.ActiveWindow.ActivePane.View.Type = wdPrintView
.MailMerge.Execute
.Close (0)
End With

FileName = "LTRCOL" & "_" & Format(Date, "ddmmyyyy") & "_" & Format(Time, "mmhhss")

oApp.Application.Documents(1).SaveAs "C:Documents and SettingsChrisDesktopLetter_AccessOutput" & "" & FileName & ".rtf"
oApp.Documents.Parent.Visible = False
oApp.Application.WindowState = wdWindowStateMinimize
oApp.ActiveWindow.WindowState = wdWindowStateMinimize
oApp.Quit (0)

Set oMainDoc = Nothing
Set oApp = Nothing
Set Rs2 = CurrentDb.OpenRecordset("AuditTrail")

Rs2.AddNew
Rs2("Filename") = TextF
Rs2("Processedby") = Environ("username")
Rs2("DateProcessed") = Format(Date, "dd/mm/yyyy")
Rs2("CountofRecords") = DCount("[Letter_code]", "LTRCOL")
Rs2("Letter_Code") = "LTRCOL"
Rs2("SavedAs") = FileName
Rs2.Update
Rs2.Close
Set Rs2 = Nothing
Else
oApp.Quit (0)
Set oMainDoc = Nothing
Set oApp = Nothing
Set Rs2 = Nothing
End If
End Function Thank you in advance for the help.

I have read posts about similar issues and am still unsure what to do about my situation. I'm using Access 2007 with 2007 file format.

I was working on this database last night, everything seemed normal. The first time I opened it this morning - a message appeared
"Cannot load Form_T_TEMPlab_SUB" (something to this extent - I only saw the message on this first attempt to open the database and did not record exactly what it said).

The next message appears unless I hold down the shift key (as recommended in another post) or use task manager to force the program to end.

"The database cannot be opened because the VBA project contained in it cannot be read. The database can be opened only if the VBA project is first deleted. Deleting the VBA project removes all code from modules, forms and reports. You should back up your database before attempting to open the database and delete the VBA project."

I am guessing it is hung up on the code embedded in the form it said it couldn't load. I don't recall altering the code on this form last night.

*Unable to import objects from this database into a fresh new one - I get the same message

*Able to manipulate forms in design view if i use the "hold shift" method, but still unable to access the VBA editor through the events, and cannot get into the vba editor using the link to it on the ribbon

*Tried deleting the Form T_TEMPlab_SUB - cannot, get the same message

What can I do to fix this? I tried looking at the database as a text file but I can't recognize any of my VBA code amongst the madness of the special characters.

Could it be possible that I left behind some unfinished/tested code last night that is now causing this error? There is a ton of code within this - both in a module and spread across countless forms.

I think the best solution may be to go back to a restore point - as I had another person test it out on a different machine and they are having the same problem (which rules out any corrupted .dll, in addition to the fact that other databases work fine on the machine).

Is there anyway to avoid this from occurring in the future?

Greetings,

My Access 2007 app to replicate records from an AS/400 running JDE to SQL Server 2008 R2 received some very odd error messages. A sample is as follows:


	Code:
	Date: 20111115 Time: 10:05:39 UserID: fandango
AppErrorMsg: Class: clsObjFRouterTbl, Function: Insert(), Values: partnumber='1000021008', wrkctr='119051', iropsq='1000'
Error Source: ADODB.Parameters
Error Number: 3265
Error Description: Item cannot be found in the collection corresponding to the requested name or ordinal.
MessageText: Error not found.

Searching around the Internet for clues / ideas, I came across this page:

"ACC2000: How to Use Parameters with ActiveX Data Objects (ADO) and Jet"
http://support.microsoft.com/kb/225897

That suggested wrapping the Parameters Values in double quotes. I tried that and testing the code in Debug / Trace mode, that blows up right away.

With the quotes removed, in Debug / Trace mode the code executes perfectly to insert records which previously failed.

Selecting only one of the records (without Debug / Trace mode) which had an error, that does complete correctly.

The Access VBA code driving the SP is as follows:


	Code:
	Public Function Insert() As Boolean
On Error GoTo Err_Insert

  Dim adoCMD As ADODB.Command
  Dim adoRS As ADODB.Recordset

  'Define attachment to database table specifics and execute commands via With block
  Set adoCMD = New ADODB.Command
  With adoCMD
    .ActiveConnection = ObjBEDBConnection.FADODBConnectionObj()
    .CommandText = "clsObjFRouterTbl_Insert"
    .CommandType = adCmdStoredProc
    .Parameters.Refresh
    .Parameters("@partnumber").Value = Me.partnumber
    .Parameters("@wrkctr").Value = Me.wrkctr
    .Parameters("@iropsq").Value = Me.iropsq
    .Parameters("@irdsc1").Value = Me.irdsc1
    .Parameters("@qtyper").Value = Me.qtyper
    .Parameters("@fixture").Value = Me.fixture
    .Parameters("@irefff").Value = Me.irefff
    .Parameters("@irefft").Value = Me.irefft
    .Parameters("@irrunl").Value = Me.irrunl
    .Parameters("@irsetl").Value = Me.irsetl
    .Parameters("@irvend").Value = Me.irvend
    .Parameters("@irpoy").Value = Me.irpoy
    Set adoRS = .Execute()
  End With

  'Return the new record's ID
  Insert = True

Exit_Insert:
  'Clean up the connection to the database
  Set adoCMD = Nothing
  Set adoRS = Nothing

  Exit Function

Err_Insert:
  Call errorhandler_Logger("Class: clsObjFRouterTbl, Function: Insert(), Values: partnumber='" & Me.partnumber & "',
wrkctr='" & Me.wrkctr & "', iropsq='" & Me.iropsq & "'")
  Insert = False
  Resume Exit_Insert

End Function

There were some dupe records, and those clearly state that the SQL Server index is what prevented those records from being accepted. This error, gives me little reason as to why the INSERT was not successful.

Any suggestions?

I want a specific action to be performed when the user goes to the next record in a form, but I don't know how to do this.

thanks in advance

Hi,

very strange and annoying issue.

i have one created database. this is split and the front end is .accde.

i have 2 computers. both running Vista and access 2007 ( same version ).

i can install my database quite happily on computer one and the file is placed locally so there is no sharing involved at all.

when i install in on computer 2, i get this message

the database cannot be opened because the vba project contained in it cannot be read ( see full error attached )

if i copy the database form computer 2 to computer one, it works!!
if i open the accdb on computer 2, it works. just not the accde.

ive been through my code and compiled it. why will it happily work on one pc but not the other whenthe same file is being used?

also,

if i place the accdb on computer 2 and make accde from it, the accde works just fine.

is it a permission issue?



regards & frustrated and confused,

Nidge

Running on a net work
AK2007

First time I have ever seen this message (the database cannot be opened because the VBA project contained in it cannot be read.). It was running ok the day before. Could our IT team run some updates that would make this error? I had the option to select cancel or OK. just click ok and everything went back to normal. Any ideas

Hi,

I was on another computer (same network) today and went to access a database I'm working on creating. When I tried to open it from this different computer, I got an error message I've never seen before. I closed out and later went to access it from my regular computer, but now that same error is being displayed here as well.

This is the error:

"The database cannot be opened because the VBA project contained in it cannot be read. The database can be opened only if the VBA project is first deleted. Deleting the VBA project removes all code from modules, forms and reports. You should back up your database before attempting to open the database and delete the VBA project.

To create a backup copy, click Cancel then make a backup copy of your database. To open the database and delete the VBA project without creating a backup copy, click OK."

I made the backup, then went back to this error and clicked OK, and it grants me access to the database again but deletes ALL VBA code. In the backup I tried various ways to get back into the VBA just to save the code in order to compile/fix it, but it will not allow me to view the code at all and every time I try I just keep getting this same error. I really don't want to start all over again writing this code!! Can anyone help?

The only suggestion I've found so far is to buy some $300 product to fix a corrupted file, which I can't do.

I thought I could just do this with error handling. My login form has a cbologin and a password text box. I put this code in the got focus and on click events of cbologin.


	Code:
	Private Sub cboLogin_GotFocus()
On Error GoTo Err_LinkTables
Exit_LinkTables:
Exit Sub

Err_LinkTables:
Call fRefreshLinks
Resume Exit_LinkTables

End Sub


How can I get this function to run if the backend cannot be found?

Greetings to all,


I'm hoping that someone can help me cause I'm frustrated ready to commit Harry Cary...


I'm starting with a completely blank DB. I'm trying to import an excel file and I'm getting the following errors...


"The database cannot be opened because the VBA project contained in it cannot be read. The database can be opened only if the VBA project is first deleted. Deleting the VBA project removes all code from modules, forms and reports. You should back up your database before attempting to open the database and delete the VBA project.


Click Ok to make a backup of the database or cancel if you do not wish to back up"


I click cancel since there isn't anything in the DB yet and get the next error...


"Microsoft Access can't find the wizard. This wizard has not been installed, or there is an incorrect setting in the Windows Registry, or this wizard has been disabled.


So I go in to look and see if there is an issue in the Add-Ins Manager and I get this error...


"The database cannot be opened because the VBA project contained in it cannot be read. The database can be opened only if the VBA project is first deleted. Deleting the VBA project removes all code from modules, forms and reports. You should back up your database before attempting to open the database and delete the VBA project.



Click Ok to make a backup of the database or cancel if you do not wish to back up"


Click Cancel and the get this error...


"The wizard you've requested is not installed or is in a bad state. Please install or reinstall the wizard. If you do not have premission to do this on your computer, please contact your help desk representative."


I have uninstalled Access and Reinstalled, I have looked up and applied KB2581301. I have screamed, cried and begged... Still nothing. Anyone know what's going on and how to fix it?

Thanks,

Tom

I have a main form with project information and subform with financial information for each related project. Every time I try to add a new record, I get the error message "field cannot be updated". I click ok and it appears again, this continues three times after and then disappears when I click ok. After which I can add a new record. This happens on the query and the form.
Can someone help me through this one? Thanks

hello ,
I want to use a wait or timer action like in my attachment file.
could someone see this and show me what I got to do?


thanks aloT!!

hi

could you please tell me what action will be happned when this both statement executed..

DoCmd.GoToRecord , , A_NEWREC
SendKeys "%N", True

Form ahse defines these statement as well.

Option Compare Database
Option Explicit

I have a problem importing into Outlook from Access. I managed to do this once but cannot do it following the same methods a second time. From my contacts folder in Outlook I open the Import and Export wizard and follow all the prompts but when I get to the stage where "the following actions will be performed" there is nowhere to allow me to select from contact information eg name, email address etc. This information is present in the access table but on this tab I am only given the options of importing from "calls" "contact types" and "switchboard items", none of which contain the basic name and email fields.
I was able to do this successfully just a few days ago but now cannot seem to. I am sure this is a simple thing but I have no idea how to make it work again.
If anyone can give me some pointers I would really appreciate it.
Thanks

Hey!

I've created two tables, one containing order data, the other additional order data. Not every order has additional order data.

First i've created them with no specific relationship and filling in data via form worked fine. If i added additional data, a new record in the additional order data table was created automatically.

Later i changed those tables to a "one to one" relationship by setting the long int field that links to the order data table to no duplicates. I just did it because i thought that's how it should bew. But since then i can't add additional order data via the form anymore, but get the error "Record(s) cannot be added; No corresponding record on the 'one' side" instead. I could just revert back to the one to many relationship, but it bothers me.

Any hints? Thank you!

whisp

Is there any way I can lock all records made before a certain date (in this case my year end date) so that accidental changes cannot be made.

I have a an append query that reads data from a SQL server data source and appends it to a table in my database. I run this query daily, and the amount of data it appends changes daily. The last day of the month always has the most data - this month it was 6,488 records. This query runs and works every day - except the last day of the month. On that day, I receive the following error:

"The table 'qryGetAccountsForNewPayables' is already opened exclusivley by another user, or it is already open through the user interface and cannot be manipulated programmatically."

I want to stress that it works just fine every other day of the week. I have tried several things to fix this. I tried to change the query to a make table query, which worked. I then made an append query to append the data from the new table to the proper table, and recieve the same error message. So I added an autonumber field, and appended 1,000 records at a time. This worked. So why when I append 1,000 records at a time it works, but when I try to do them all at once it fails? Can anyone help?

Thanks,
Eric


Not finding an answer? Try a Google search.