Results 1 to 2 of 2
  1. #1
    Camacho is offline Novice
    Windows 8 Access 2016
    Join Date
    May 2016
    Posts
    1

    ComboBox and lists

    Hello I'm trying to make a form where, accordingly to what is selected in a ComboBox, to show some words in a list, the problem is the VBA code I've developed it doesn't allow me to change the items in the ComboBox, being stuck in the first option that appears in the ComboBox, my code is:

    Option Compare Database
    Option Explicit


    Private Sub Combo2_Click()


    Me.Combo2 = Me.Combo2.ItemData(0)

    Combo2_AfterUpdate
    End Sub


    Private Sub Combo2_AfterUpdate()


    Me.List4.RowSource = "SELECT Nome " & _
    "FROM tbl1_Herdeiros " & _
    "WHERE ID_Herancas = " & Nz(Me.Combo2)
    Me.List4.Requery
    Me.List4 = Me.List4.ItemData(0)

    End Sub

    Can anyone explain me what might be wrong with my VBA code?

  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,521
    I would take out the click event code for starters. Also make sure the combo isn't locked and the form allows edits.
    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. Fun with Drop-down lists.
    By againstevrythng in forum Access
    Replies: 2
    Last Post: 12-12-2014, 02:49 PM
  2. Help: Navigating with Lists
    By DB88 in forum Access
    Replies: 2
    Last Post: 05-19-2014, 03:09 PM
  3. Form Pic Lists
    By Stephen Fetherston in forum Forms
    Replies: 3
    Last Post: 01-06-2012, 12:20 PM
  4. Access lists
    By michaelcoomes in forum Access
    Replies: 1
    Last Post: 11-04-2010, 11:18 AM
  5. Access lists? Help!!!
    By megank in forum Access
    Replies: 1
    Last Post: 03-15-2009, 04:11 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