Access Macro

Copper Contributor

I have a problem with Access (*.mdb) database. I have a form with function button duplicate record. It is functioning well with latest access database type *.accdb but I need to use database as *.mdb type, and that function is giving error "The 'Copy' RunCommand cannot be run in disabled mode". Is there another way (build macro) to make that duplicate record function working?

6 Replies

@jkoivula1964 

That error is not 100% clear to me, but it sounds like it would be in a version of Access where Macros have been disabled. 

Just to get on common ground, please provide more details about which version of Access you are using. Also, please confirm that you have enabled macros. 

I am aware that this would impact both the accdb--which you indicate doesn't raise the error--and the mdb, but let's get on the same page to start.

EnableMacros.jpg

 

@jkoivula1964 

 

Also, please confirm that this is a macro, not a VBA procedure. 
Thanks.

@George Hepworth 

Hi! Access version is

jkoivula1964_0-1608183626297.png

Whatever I do, it will work OK in *.accdb type. All macros are enabled (are NOT as default).

 

Example-1. 

Private Sub Command381_Click()

 

    DoCmd.RunCommand acCmdSelectRecord

    DoCmd.RunCommand acCmdCopy

    DoCmd.RunCommand acCmdRecordsGoToNew

    DoCmd.RunCommand acCmdSelectRecord

    DoCmd.RunCommand acCmdPaste

 

Exit_Command381_Click:

    Exit Sub

 

End Sub

 

This is working also in *mdb type, but database cannot be saved, it will give message

Nimetön.gif

 

Example-2

Nimetön1.gif

 

That will end to 

Nimetön3.gif

@jkoivula1964 

 

I really hate this new Access. Now when I try to link database into another software, it is asking me

username and password... I have no idea of those...

jkoivula1964_0-1608214719996.png

 

@jkoivula1964 

Thanks, seeing that error message in full does clarify one part of the problem, at least. This happens, I assume, when you try to save the file in the mdb format.

Note that is says, in part, "This form or report contains changes that are incompatible with the current database format." That means you are trying to save a file in the mdb format, but that file contains features which were introduced ONLY in the accdb format. That has nothing to do with this macro itself, only with the ability to save the mdb after you have changed it. It works in the accdb version because that feature is part of the accdb. I can't see the mdb, of course, so I can't know what that feature is.

 

The fact that there is an error raised by the copy command can't be resolved without actually having a copy of the mdb or accdb to examine. It's going to be related to changes from mdb to accdb, but exactly what that is will take some sleuthing.

 

I'll respond to your other post directly.

 

@jkoivula1964 

This is also understandable if you are trying to link to an mdb, not to an accdb.

The old User Level Security for mdbs was dropped from the accdb format. However, that old mdb is apparently still linked to a ULS .mdw which had a username and password under ULS. Even it was the default Admin and blank password, it's still being encountered. 

 

You may be able to work this out, but you'll need to figure out how it now works.

 

Do you have to retain the mdb? Can't you simply clean all of this up by saving your work as an accdb?