Results 1 to 3 of 3
  1. #1
    tbassngal is offline Novice
    Windows XP Access 2007
    Join Date
    Sep 2010
    Posts
    27

    Combo Box Woes

    Hi all,

    I have used this code before in previous databases but am now having issues of cboDesc1 = null and it shouldn't be. My sSQL is correct. The funny thing is when I run this code, the cboDesc1 box becomes dimmed out and unclickable but has no value. I am eventually going to have 3 cboDesc boxes that will populate based upon the value in sSQL but I can't even get the first one to work. I am not used to working with bound objects. These combo boxes are bound to the table... is that the problem? It shouldn't be ??? Database attached. P.S. it isn't mine, I am just trying to help fix the problem.

    sSQL value is
    "SELECT Desc1 FROM tblApplicationDescription WHERE [Application] = 'Tina Test' ORDER BY Desc1"

    where cboDesc1 should value Tina1, cboDesc2 should value Tina2, etc.

    These values are all in one table for one row of data



    Private Sub cboApplication_AfterUpdate()
    Dim sSQL As String
    'MsgBox "The Code is Executing!"

    'clear cboDesc1
    Me.cboDesc1 = Null

    sSQL = "SELECT Desc1 FROM tblApplicationDescription"
    sSQL = sSQL & " WHERE [Application] = '" & Me.[cboApplication] & "' "
    sSQL = sSQL & " ORDER BY Desc1"

    'for debugging
    'Debug.Print sSQL

    Me.cboDesc1.RowSource = sSQL

    'check if cboDesc1 has values
    If IsNull(Me.cboDesc1.ItemData(0)) Then
    Me.cboDesc1.Enabled = False
    Else
    Me.cboDesc1.Enabled = True
    Me.cboDesc1 = Me.cboDesc1.ItemData(0)

    'optional
    Me.cboDesc1.SetFocus
    Me.cboDesc1.Dropdown
    End If

    End Sub

  2. #2
    tbassngal is offline Novice
    Windows XP Access 2007
    Join Date
    Sep 2010
    Posts
    27

    Combo Box issues

    This can be deleted...

  3. #3
    tbassngal is offline Novice
    Windows XP Access 2007
    Join Date
    Sep 2010
    Posts
    27
    Okay, I think I have it figured out but how would I make it so that the Desc1 was populated 3 times without having to copy and paste code 3 times. Loop ??? I haven't done this in such a long time... ??? Can someone help me by adding looping code for 3 cboDesc boxes, cboDesc1, cboDesc2, cboDesc3

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

Similar Threads

  1. Replies: 4
    Last Post: 08-16-2011, 05:54 PM
  2. Combo Box Query Lookup ListIndex Woes
    By Jon-G in forum Access
    Replies: 7
    Last Post: 08-05-2011, 02:57 PM
  3. error message woes
    By ggs in forum Forms
    Replies: 4
    Last Post: 05-29-2011, 04:03 AM
  4. Replies: 5
    Last Post: 01-02-2011, 10:09 AM
  5. Combo box woes...
    By jonbonazza in forum Forms
    Replies: 3
    Last Post: 06-21-2010, 11:34 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