Aziera
May 18th, 2004, 10:14 PM
Hello guys ...
I have a combination of 3 combo boxes.
The first one is cboComFrom where will list all the company id.
The second one is cboComTo where when the user select any data from cboComFrom, the rest of the data will appear here.
example:
data in cboComFrom : 1,2,3,4,5,6
user select : 3
cboComTo will appear: 3,4,5,6
I already got this one..but the problem is when dealing with third combo boxes, cboEmpNo.The combo boxes here will appear all the relate employee no base on selected company id in cboComTo. But donno why the it doesnt work.
code:
Private Sub cboComFrom_Click()
Dim index As Integer
'cboComTo.Clear
'to get the employee number base on selected company id
If chkStatus(index).Value = 0 Then
strSQL = "Select EmpNo From Emp00Curr Where Recsts = '0' Order By ComID"
End If
If chkStatus(index).Value = 1 Then
strSQL = "Select EmpNo From Emp00Curr Where Recsts = '1' Order By ComID"
End If
If chkStatus(index).Value = 2 Then
strSQL = "Select EmpNo From Emp00Curr Where Recsts = '2' Order By ComID"
End If
If chkStatus(index).Value = 3 Then
strSQL = "Select EmpNo From Emp00Curr Order By ComID"
End If
'intstatus = xPutSessionID(intSessionIDEC)
RecordOption = 1
intstatus = XQLFetch(intCursorIDEC, RecordOption, Len(Emp00CurrSQL), Emp00CurrSQL, 1, 1, 0)
Dim i As Integer
' Loop through list of item in cboComFrom
' from selected item through end of list
Screen.MousePointer = vbHourglass
For i = cboComFrom.ListIndex To cboComFrom.ListCount - 1
' Copy item from cboComFrom to cboComTo
cboComTo.AddItem cboComFrom.List(i)
Do While intstatus = 0
'put the data into the combo box
With cboEmpFrom
.AddItem (Trim(Emp00CurrSQL.EmpNo))
End With
RecordOption = 2
intstatus = XQLFetch(intCursorIDEC, RecordOption, Len(Emp00CurrSQL), Emp00CurrSQL, 1, 1, 0)
Loop
Next
' If cboComTo contains items...
If cboComTo.ListCount Then
' Select first item
cboComTo.ListIndex = 0
End If
Screen.MousePointer = vbNormal
End Sub
anyone who can detect the error plz help me....i am using pervasive sql as my database
I have a combination of 3 combo boxes.
The first one is cboComFrom where will list all the company id.
The second one is cboComTo where when the user select any data from cboComFrom, the rest of the data will appear here.
example:
data in cboComFrom : 1,2,3,4,5,6
user select : 3
cboComTo will appear: 3,4,5,6
I already got this one..but the problem is when dealing with third combo boxes, cboEmpNo.The combo boxes here will appear all the relate employee no base on selected company id in cboComTo. But donno why the it doesnt work.
code:
Private Sub cboComFrom_Click()
Dim index As Integer
'cboComTo.Clear
'to get the employee number base on selected company id
If chkStatus(index).Value = 0 Then
strSQL = "Select EmpNo From Emp00Curr Where Recsts = '0' Order By ComID"
End If
If chkStatus(index).Value = 1 Then
strSQL = "Select EmpNo From Emp00Curr Where Recsts = '1' Order By ComID"
End If
If chkStatus(index).Value = 2 Then
strSQL = "Select EmpNo From Emp00Curr Where Recsts = '2' Order By ComID"
End If
If chkStatus(index).Value = 3 Then
strSQL = "Select EmpNo From Emp00Curr Order By ComID"
End If
'intstatus = xPutSessionID(intSessionIDEC)
RecordOption = 1
intstatus = XQLFetch(intCursorIDEC, RecordOption, Len(Emp00CurrSQL), Emp00CurrSQL, 1, 1, 0)
Dim i As Integer
' Loop through list of item in cboComFrom
' from selected item through end of list
Screen.MousePointer = vbHourglass
For i = cboComFrom.ListIndex To cboComFrom.ListCount - 1
' Copy item from cboComFrom to cboComTo
cboComTo.AddItem cboComFrom.List(i)
Do While intstatus = 0
'put the data into the combo box
With cboEmpFrom
.AddItem (Trim(Emp00CurrSQL.EmpNo))
End With
RecordOption = 2
intstatus = XQLFetch(intCursorIDEC, RecordOption, Len(Emp00CurrSQL), Emp00CurrSQL, 1, 1, 0)
Loop
Next
' If cboComTo contains items...
If cboComTo.ListCount Then
' Select first item
cboComTo.ListIndex = 0
End If
Screen.MousePointer = vbNormal
End Sub
anyone who can detect the error plz help me....i am using pervasive sql as my database