Topics Search

Protect the VBA Code

Protect the VBA Code
Views: 16
I have MDB and user can press Shift key to access in the VBA code. How to prevent this during the form loading time ?
Sponsored Links:

Similar posts...


how to protect queries and VBA code against stealing

how to protect queries and VBA code against stealing Icon
We are designing a database which has several queries and vba codes. We don't want anyone to view the queries or steal them as it is proprietary information.

What is the best way to password protect the queries and VBA codes and still letting the users to use the database.

Access - Open Document / Protect

Access - Open Document / Protect Icon
I'm trying to figure out how to open a Word doc from Access, populate certain fields, then protect the document from editing (just allowing form entry).

All of this is relatively simple, opening the document and populating the fields. The problem comes that you cannot populate the fields in a protected document, therefore, the document must be unprotected.

Then, because the control has passed to Word, I cannot figure out how to protect the form from my Access VBA code.

Make your own CODE to lock the database objects

Make your own CODE to lock the database objects Icon
securing the database objects have different ways:
1. Password protect the database
2. Password protect the VB codes
3. Disable allowbypasskey
4. Make MDE file for versions 2003 and previous
5. ULS


a. the simplest way to protect is by password protecting
b. Allowbypasskey diabling is a protection done by vb code
c. by making the MDE file, the forms, report, dap, macro, and modules are locked thereby it cannot be opened for editing or for opening.
d. by making ULS, the objects are locked by access, I think this goes by code again and we setup its password.

Therefore, protecting the database objects were done thru coding matched by password. So therefore, maybe there is a way that we can make our own CODE to lock the database objects.And I think our gurus here in this forum might help us out with that code.Can we do this?

Hide VBA code from users

Hide VBA code from users Icon
If your database contains Visual Basic for Applications (VBA) code, you can hide that code by saving your Microsoft Office Access database in the .accde file format. Saving a database as an .accde file compiles all VBA code modules, removes all editable source code, and compacts the destination database. Your VBA code retains its functionality, but the code cannot be viewed or edited. In general, the database will continue to function as usual — you can still update data and run reports.

Cannot open VBA code

Cannot open VBA code Icon
A few days ago my database suddenly started pumping out this error message:
"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 form modules, forms and reports. You should back up your database before attempting to open the database and delete the VBA project."

This message appears every time a form with VBA code is opened, and every time I try to open the VBA editor. Of course I have a backup, however I rather not be forced to redo about 6 hours of work.
Looking across the internet it seams like quite a few people have had this problem, but no solutions. As far is I can tell, something in the VBA code has caused the database to become corrupted.
So my question is this, is there any way I could possibly recover at least some of the code? Could I somehow force Access to show me the code, even if a part of it is corrupt?

Update table via VBA code

Update table via VBA code Icon
Have a table (several hundred entries) which must be updated weekly using VBA code. I know how to write the actual VBA code (for each record) but I do not know how/where/what is necessary to open the table, read each record seq and update based on VBA code (function call return value) and to finally close table.

AllowEdit Range on excel spreadsheet via Access VBA

AllowEdit Range on excel spreadsheet via Access VBA Icon
I am struggling a bit in Access VBA. I export files from Access vba and then open the file and do some formatting and then password protect that excel file. However I want the user to able to edit two columns. I try below code but it is not doing the job. It gives me runtime error 1004 Method Columns of object_Global failed.

With xlApp
.Visible = False
.Workbooks.Open (outpath + outfile1)
.ActiveSheet.Protection.AllowEditRanges.Add Title:="myRange", Range:=Columns("O:P"), Password:="pass"
End with

VBA Code Clean up?

VBA Code Clean up? Icon
I used the resources of this forum to get the proper code I needed to open and close forms at the click of a button and was able to get the code into the db and working properly.

Fast forward a few hours, with no changes made, and the click of a command button is now shutting down Access. At the advice of a co-worker, I grabbed an MZ-Tool for VBA code clean up, and my eyes glazed over. I'm not even sure if this is the issue, or the correct way to resolve.

There is VBA code on of the forms (6 in total).

Exporting to PDF via VBA Causing Database Corruption

Exporting to PDF via VBA Causing Database Corruption Icon
I have a database that I have built that needs to export a large set of data to PDF for each county in Florida. If I manually export of these (without VBA code) to PDF, they work fine and my database does not go corrupt.

If I leave the code in VBA to export any county under 50,000KB, they all work perfect and the database does not corrupt. However, I have one relatively large PDF exports at 166,708KB.

As soon as I run the code to export this PDF file (and compact and repair my database thereafter) I get a error message upon re-opening the database stating that my VBA code is corrupt.

It then prompts me through some more error messages and it ends up erasing VBA code and any objects with VBA code attached. I'm just curious as to the reason why this file size is leading to a database corruption when it's coded into VBA.

Preventing Changes to your Microsoft Access VBA Code

Preventing Changes to your Microsoft Access VBA Code Icon
If your database contains Visual Basic for Applications (VBA) code procedures, you want to ensure that your users can't make changes unless authorised or qualified to do so. Access to the code can be prevented in a couple of different ways: Password protecting your VBA code.Saving the database as a Microsoft Database Executable (MDE) format.