Results 1 to 6 of 6
  1. #1
    Join Date
    May 2019
    Posts
    65

    Setting Property Value for a combo box

    I use the following command to set a value to the "CLFacilityOwnerName" combo box on a form. All the other property values that I'm am setting for different forms work, but they are just text boxes.



    #
    DoCmd.SetProperty "CLFacilityOwnerName", acPropertyValue, CFacilityOwnerName1
    #
    Why doesn't this work on a combo box?

  2. #2
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,651
    wouldn't something like this be easier?

    Code:
    Me.Mycombobox = MyValue

  3. #3
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,791
    I would agree with Moke123 that just setting the default property to something ought to be simpler. However, if it's not working for you on a combo on a form but it is for other controls, that's an oddity. The fact that it's not working in a particular instance makes me think that there's a subform or navigation form involved. If there is, then neither method is going to work if the reference isn't correct.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,899
    I agree with moke123 suggested syntax to set a data control's value. Also, Value is default property of data controls, don't even have to reference it.

    Me.CLFacilityOwnerName = Me.CFacilityOwnerName1

    I also wonder why need to do this in code. If facility owner name is already in CFacilityOwnerName1, why need to repeat it in CLFacilityOwnerName?


    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    Join Date
    May 2019
    Posts
    65
    To both Moke123 and June7,
    Thanks for your help, but a misspelling caused the problem. The original code worked.

    Thanks again.

  6. #6
    Mickjav is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Mar 2019
    Location
    Margate, Kent
    Posts
    123
    Are you using Option Explicit if so it should have picked up that error??

    mick

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

Similar Threads

  1. Replies: 7
    Last Post: 10-06-2019, 07:37 AM
  2. Setting Control Source Property Issue
    By Sarah11 in forum Forms
    Replies: 2
    Last Post: 09-23-2017, 10:37 PM
  3. Replies: 1
    Last Post: 10-25-2012, 12:58 PM
  4. Setting visible property of subreport?
    By GaryElwood in forum Reports
    Replies: 1
    Last Post: 09-23-2011, 07:49 PM
  5. Replies: 1
    Last Post: 08-12-2010, 10:33 PM

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