SHAWTY721 0 Newbie Poster

I am trying to populate a tabbed list box with values that are present in a database table. I am having an issue with getting values to appear in the text box. I was wondering if anyone could help me out. I am using VB6 with this project.

I have attached pieces of my code. Hopefully showing what I am trying to accomplish will help.

Private Sub Form_Load()
    
btnSave.Enabled = False
btnSave.BackColor = glbColorLtGray
lblIndex.Enabled = False
lblName.Enabled = False
lblMin.Enabled = False
lblMax.Enabled = False
lblPLC.Enabled = False
'txtIndexNum.Enabled = False
'txtName.Enabled = False
'txtMin.Enabled = False
'txtMax.Enabled = False
'txtPLC.Enabled = False

Call UpdateFromDB
Call UpdateList


End Sub

---------------------------------------------------
Sub UpdateFromDB()
'This subroutine updates data from the database

Dim Count As Integer
Dim objRS As Recordset

On Error Resume Next

'Connect to database
Set objRS = glbCurrentDB.OpenRecordset("SELECT * FROM tblInput", , dbOpenForwardOnly)

'If Not objRS.EOF Then
'glbIndex(glbInput) = objRS![Index]
'glbName(glbInput) = objRS![Name]
'glbRawMin(glbInput) = objRS![RawMin]
'glbRawMax(glbInput) = objRS![RawMax]
'glbPCL(glbInput) = objRS![PLC]


Set objRS = Nothing

End Sub

----------------------------------------------------

Sub UpdateList()
'This subroutine updates the input list

Dim TabSpace(6) As Long
Dim objRec As Recordset
Dim LastEntry As String
Dim Stage As Integer

On Error GoTo ErrorHandler

'Define tab spacing
TabSpace(0) = 2     'Initial Space
TabSpace(1) = 80    'After Index
TabSpace(2) = 109   'After Name
TabSpace(3) = 131   'After RawMin
TabSpace(4) = 156   'After RawMax
TabSpace(5) = 190   'After PLC

'Set tab spacing API
Call SendMessage(frmDatabaseView.lstInput.hwnd, LB_SETTABSTOPS, UBound(TabSpace) + 1, TabSpace(0))

'Define last entry for use
If frmDatabaseView.lstInput.ListCount > 0 Then LastEntry = frmDatabaseView.lstInput.List(frmDatabaseView.lstInput.ListCount - 1)

'Clear list
frmDatabaseView.lstInput.Clear

Set objRec = Nothing

Exit Sub


ErrorHandler:

MsgBox Err.Description, 16, "Error Populating Input List"
    
    
End Sub
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.