Results 1 to 4 of 4
  1. #1
    meena is offline Novice
    Windows 8 Access 2013
    Join Date
    Jul 2014
    Posts
    13

    Question I have two list boxes, I want the second one to be populated based the first select

    I am a novice in access, learning it on my own by trial and error. please guide and help.

    I have two list boxes, I want the second one to be populated based the selection in the first one. I have the below code but it does not seem to work.

    Private Sub lst_servicetype_LostFocus()

    Dim db As DAO.Database
    Dim rs As DAO.Recordset
    Dim MyVal As Long
    Dim strSql As String

    Set db = CurrentDb()

    If Me.lst_servicetype.Value = "Attractions" Then
    strSql = ("Select Attraction from SingaporeAttractions_Master order by attraction")
    Set rs = db.OpenRecordset(strSql, dbOpenDynaset)
    Me![lst_servicedtls].RowSourceType = "Table/List"


    Me![lst_servicedtls].RowSource = rs
    Me![lst_servicedtls].Requery
    rs.Close
    Set rs = Nothing
    End If

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

  3. #3
    meena is offline Novice
    Windows 8 Access 2013
    Join Date
    Jul 2014
    Posts
    13
    Thanks Paul, It worked !!!

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,643
    Happy to help and welcome to the site by the way!
    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: 15
    Last Post: 11-20-2013, 04:30 PM
  2. Replies: 3
    Last Post: 08-26-2012, 10:04 PM
  3. Replies: 5
    Last Post: 07-26-2012, 12:59 PM
  4. Replies: 4
    Last Post: 04-16-2012, 11:48 AM
  5. Replies: 1
    Last Post: 03-01-2009, 09:53 AM

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