Results 1 to 3 of 3
  1. #1
    weasel7711 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Feb 2011
    Posts
    25

    Question Proplem referencing control with SetProperty in Macro Builder in Web Database

    I was originally having a problem referencing a submacro within the form so I moved the submacro outside and referenced it that way. My macro tries to set the properties of a number of text boxes in the form. I want to lock/unlock all of the fields based on a toggle button int he form.

    In the macro I have the following

    Code:
    SetProperty
        Control Name [Forms]![frmRMA]![txtRMA]
        Property Locked
        Value =[LocalVars]![varLockedYesNo]



    Every time I run the code it tells me that the control name is mispelled or does not exist. I have tried without brackets as well and I get the same error. I've even tried with/without periods instead of exclamation points. Same error.

    I've tried referencing a different text box, same error.

    When the control name box is empty I can use the intellisense to use what it suggests. It finds all of the references, first with Form! then it finds the form frmRMA, then it shows all of the controls with a wrench icon next to each. Even with the suggested sytax it still throws the same error suggesting that the control name is mispelled.

    The wierd thing is I can use that same reference string ("[Forms]![frmRMA]![txtRMA]") in an expression and get the value and it works just fine. I only seem to have this problem with the SetProperty function. I've googled it and I've seen a few people have the same problem but I have not yet found a solution.

  2. #2
    weasel7711 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Feb 2011
    Posts
    25
    I screwed around with intellisense in the Control Name box and tried Forms!frmRMA.Controls!txtRMA as well as Forms!frmRMA.Form.Controls!txtRMA and neither of them will work either, I get the same error.

  3. #3
    weasel7711 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Feb 2011
    Posts
    25
    Thanks in no way to anyone on this forum I discovered that you (for some odd reason) don't put the full address of the control you are using. You just use the control name. So it would be
    Code:
    Set Property
         Control Name: txtRMA
         Property: Locked
         Value: =[LocalVars]![varLockedYesNo]
    Last edited by weasel7711; 09-13-2012 at 12:25 PM. Reason: forgot end code tag

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Login Security w/ Macro Builder and Table
    By benthamq in forum Programming
    Replies: 14
    Last Post: 01-28-2013, 03:51 PM
  2. VBA Referencing Subform Control Error 2465
    By Jester0001 in forum Programming
    Replies: 3
    Last Post: 05-30-2012, 07:31 AM
  3. Run Query in Macro Builder
    By chewbears in forum Queries
    Replies: 0
    Last Post: 11-21-2011, 09:18 AM
  4. referencing a control
    By looloo in forum Programming
    Replies: 3
    Last Post: 09-23-2011, 07:57 PM
  5. Correct way to SetProperty with Macro Builder
    By jasonbarnes in forum Forms
    Replies: 4
    Last Post: 02-25-2011, 02:37 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums