Results 1 to 5 of 5
  1. #1
    VSCurtis is offline Advanced Beginner
    Windows 7 64bit Access 2016
    Join Date
    Dec 2014
    Posts
    65

    Unbound Combo Not Displaying Data But Feild In Table Has Data Value

    Hi Guys,



    This problem seems simple but it makes no sense. I have a combo box on my form that isn't displaying it's underlying value in the table. The code is simple enough and works for all other combo boxes on the form. I don't understand what's going on. The offending code is in bold. The code is:
    Code:
    Private Sub LoadCardFields()
    ResetFields
    txtCardName.SetFocus
    If Not IsNull(rsCards("Card Name")) Then
       txtCardName.Text = rsCards("Card Name")
    Else
       txtCardName.Text = vbNullString
    End If
    If Not IsNull(rsCards("Category ID")) Then
       cmbCardCategory.Value = rsCards("Category ID")
    Else
       cmbCardCategory.Value = -1
    End If
    If Not IsNull(rsCards("Attribute ID")) Then
       cmbCardAttribute.Value = rsCards("Attribute ID")
    Else
       cmbCardAttribute.Value = -1
    End If
    txtLevel.SetFocus
    If Not IsNull(rsCards("Level")) Then
       txtLevel.Text = rsCards("Level")
    Else
       txtLevel.Text = vbNullString
    End If
    If Not IsNull(rsCards("Monster ID")) Then
       cmbMonsterType.Value = rsCards("Monster ID")
    Else
       cmbMonsterType.Value = -1
    End If
    txtAttackPoints.SetFocus
    If Not IsNull(rsCards("Attack Points")) Then
       txtAttackPoints.Text = rsCards("Attack Points")
    Else
       txtAttackPoints.Text = vbNullString
    End If
    txtDefensePoints.SetFocus
    If Not IsNull(rsCards("Defense Points")) Then
       txtDefensePoints.Text = rsCards("Defense Points")
    Else
       txtDefensePoints.Text = vbNullString
    End If
    txtPendulumScale.SetFocus
    If Not IsNull(rsCards("Pendulum Scale")) Then
       txtPendulumScale.Text = rsCards("Pendulum Scale")
    Else
       txtPendulumScale.Text = vbNullString
    End If
    txtLevel.SetFocus
    If Not IsNull(rsCards("Level")) Then
       txtLevel.Text = rsCards("Level")
    Else
       txtLevel.Text = vbNullString
    End If
    txtDescription.SetFocus
    If Not IsNull(rsCards("Description")) Then
       txtDescription.Text = rsCards("Description")
    Else
       txtDescription.Text = vbNullString
    End If
    If Not IsNull("Forbidden") Then
       chkForbidden.Value = rsCards("Forbidden")
    Else
       chkForbidden.Value = False
    End If
    txtCardName.SetFocus
    CheckCardCategory
    LoadCardTypeData
    End Sub

  2. #2
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,388
    Pardon me for asking but what's the point of putting data into an unbound combobox like that?

  3. #3
    VSCurtis is offline Advanced Beginner
    Windows 7 64bit Access 2016
    Join Date
    Dec 2014
    Posts
    65
    Dave,
    All data is being added via code. AddNew, Edit, Update combined with transactions. This is the procedure used to add data to the main table. I'm not a fan of bound controls

  4. #4
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,388
    All data is being added via code. AddNew, Edit, Update combined with transactions. This is the procedure used to add data to the main table. I'm not a fan of bound controls
    Well, OK, but in this case the comboboxes don't make much sense. They could be textboxes. Also, I didn't see any code for transferring the data loaded from rsCards into the receiving table. That must be in the called LoadCardTypeData procedure.

    Try this. Sometimes a vbcrlf gets unintentionally into data and creates a multiline data field and if the textbox (or combobox) shows only one line due to its height, you think it's empty.
    Code:
    If Not IsNull(rsCards("Attribute ID")) Then
       debug.print rsCards("Attribute ID")
       cmbCardAttribute.Value = rsCards("Attribute ID")
    Else
       cmbCardAttribute.Value = -1
    End If
    debug.print cmbCardAttribute

  5. #5
    VSCurtis is offline Advanced Beginner
    Windows 7 64bit Access 2016
    Join Date
    Dec 2014
    Posts
    65
    Dave
    Combo boxes are used because multiple values are possible. I will check the data, This procedure is used solely for displaying data. The data insert procedure is a different procedure SaveCardData

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

Similar Threads

  1. Replies: 39
    Last Post: 03-15-2017, 07:34 PM
  2. Split DB Not Displaying Combo Box Data
    By Twitchie in forum Forms
    Replies: 3
    Last Post: 03-17-2014, 11:38 AM
  3. Replies: 2
    Last Post: 01-06-2014, 04:22 PM
  4. Replies: 3
    Last Post: 12-17-2013, 05:14 AM
  5. Replies: 2
    Last Post: 12-05-2012, 10:17 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