Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2005
    Posts
    127

    Unanswered: Locking VBA Code from Viewing - Issues after doing this

    All,
    Due to some internal integrity issues, I have a need to lock the VB code in an Access Application from viewing by others who are "savvy" enough to get into that area. However, I am finding in some instances, with the code locked for viewing, it won't run simple tasks. Example -

    DoCmd.DeleteObject acForm, "Start - LP"
    MsgBox "Connection Issues have been Discovered!", vbOKOnly, "Kohl's Fine Jewelry Tracking Program"
    DoCmd.CopyObject , "Start - LP", acForm, "Start - LP 2"
    MsgBox "S Drive not Connected! RTV Tote Shipments not accepted until connection is restored.", vbOKOnly, "Kohl's Fine Jewelry Tracking Program"
    DoCmd.OpenForm "Start - LP", acNormal, , , , acWindowNormal

    It errors on the DeleteObject line, and throws error code "run-time error '2501' The DeleteObject action was cancelled." Yet, if I unlock the code for viewing and save it unlocked, it runs just fine.

    I struggle to understand why some code runs just fine when it is locked, and other code like this does not. Is there a way to have it unlock itself temporarily, run the code, and then re-lock itself from viewing again, or am I missing something?

  2. #2
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    629
    Provided Answers: 32
    I noticed that Runtime doesnt run some commands.
    try NOT using delete object command, use a workaround.
    (there should be no reason to delete objects anyway)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •