Results 1 to 8 of 8
  1. #1
    raffi is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Mar 2014
    Location
    Inside a Sub Procedure
    Posts
    88

    auto select first record

    hello friends, i have a data entry form,a location combo-box and an item number combo-box



    the combo-box i would like to auto select first record is the location combo-box, the location combo-box is requeried and updated based on what item i insert in the item combo-box

  2. #2
    NTC is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2009
    Posts
    2,392
    you need to determine the 'first' record of the combo box and then write that value into the combobox..... let's say the combobox shows
    1 France
    2 England
    3 Germany
    and it is bound to the key field (integer)

    then you must determine which is the 'first' record - not sure how that is done in your case - and then put Me.ComboBox = 1 after the requery

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Or try

    Me.ComboName = Me.ComboName.ItemData(0)
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    NTC is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2009
    Posts
    2,392
    = Me.ComboName.ItemData(0)

    that's a new one for me - will have to give it a try sometime......though not sure I've ever needed to auto fill the combobox beyond just a default value......

  5. #5
    raffi is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Mar 2014
    Location
    Inside a Sub Procedure
    Posts
    88
    oh i need to auto select the first record cuz every item has a different location, the location combo-box always changes based on what item i have in the item combo-box. and thx guys when i go home ill give it a go

  6. #6
    raffi is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Mar 2014
    Location
    Inside a Sub Procedure
    Posts
    88
    Quote Originally Posted by pbaldy View Post
    Or try

    Me.ComboName = Me.ComboName.ItemData(0)

    i include this in afterupdate event of the item combo-box ? because in the item combo-box i already have a (not code) but macro requery serialNumber Combo-box

  7. #7
    raffi is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Mar 2014
    Location
    Inside a Sub Procedure
    Posts
    88
    it worked i set the code in the item on click event and now i dont have to choose the location it will auto select the first record many thanks for the information which u have provided me with

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Happy to help!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 4
    Last Post: 08-18-2013, 07:40 PM
  2. How Do I: Auto Select NavigationButton?
    By RichardAnderson in forum Forms
    Replies: 8
    Last Post: 08-16-2013, 08:24 AM
  3. Replies: 3
    Last Post: 01-24-2013, 08:16 PM
  4. Auto select value: form
    By Gilgamesh in forum Access
    Replies: 1
    Last Post: 12-20-2012, 10:50 PM
  5. When I select name code appear auto
    By miziri in forum Forms
    Replies: 0
    Last Post: 03-09-2010, 02:10 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