Results 1 to 4 of 4
  1. #1
    ksor's Avatar
    ksor is offline Competent Performer
    Windows 10 Access 2010 32bit
    Join Date
    Feb 2017
    Posts
    126

    Presetting a combobox ???

    I have a combobox populated with items from a table.



    I want the form to show records with the value from the combobox i a specific field - and it works ... sort of !

    I want to PRESET the combobox to the FIRST item and I use this code to do it:

    cboHType.SetFocus
    cboHType.Selected(0) = True

    But in whitch event should I place the presetting code ?

    I have tried Load, Open, Current ... non of them gives the result I want

  2. #2
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Not exactly sure of your intent, here, but it's not where you're placing it, it's that you're missing a line of code:

    Code:
    Me.cboHType.SetFocus
    Me.cboHType.Dropdown
    Me.cboHType.Selected(0) = True

    That'll work wherever you want it to, I think, but if you expect the same thing to happen in doing this, as it would if you physically made a selection from the Combobox, you'll need to call that event (presumably the cboHType_Afterupdate event) as well.

    Code:
    Me.cboHType.SetFocus
    Me.cboHType.Dropdown
    Me.cboHType.Selected(0) = True
    Call cboHType_AfterUpdate

    Linq ;0)>

  3. #3
    ksor's Avatar
    ksor is offline Competent Performer
    Windows 10 Access 2010 32bit
    Join Date
    Feb 2017
    Posts
    126
    Thx ... the dropdown did the trick there - now the first item is shown.

    ... and the AfterUpdate works too !

    Thx !

  4. #4
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Glad we could help!

    Linq ;0)>

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

Similar Threads

  1. Replies: 1
    Last Post: 01-16-2015, 09:28 AM
  2. opening a form and presetting value
    By jillp in forum Programming
    Replies: 13
    Last Post: 09-21-2012, 11:19 AM
  3. Replies: 1
    Last Post: 09-06-2011, 01:47 PM
  4. Replies: 0
    Last Post: 08-24-2010, 06:38 PM
  5. Replies: 0
    Last Post: 12-16-2009, 01:14 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