I Have been Strugling to Write the Code for Multicolumn to Display two feilds in m combo below is my code for the it
keeps on giving the Error
DATASOURCE NAME NOT FOUND AND NO DEFAULT DRIVER SPECIFIED
where as i already supplied this plz have look
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim strSQL As String
On Error GoTo General_Error
cn.Open SysConnect (This is Connection String where everey thing is supplied)
rs.CursorType = adOpenKeyset
rs.LockType = adLockOptimistic
strSQL = ""
strSQL = "Select * from cus0001s"
rs.Open Trim(strSQL), cn, , , adCmdUnspecified
NSDataCombo1.Columnclear
If Not rs.EOF And Not rs.BOF Then
While Not rs.EOF
If Not IsNull(rs!cid) Then
NSDataCombo1.AddColumn Trim(rs!cid)
NSDataCombo1.AddColumn Trim(rs!cin)
End If
rs.MoveNext
Wend
End If
rs.Close
cn.Close
On Error GoTo 0
Exit Sub
General_Error:
MsgBox "Error: [" & Err.Number & "] " & Err.Description, vbCritical + vbOKOnly, "Stock Control Management SCM (V1.01)"
If rs.State = ADODB.adRecObjectOpen Then
rs.Close
End If
If cn.State = 1 Then
cn.Close
End If
On Error GoTo 0
- Add new comment
- 301 views