Skip to main content

Need Help for NSDataCombo

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
Submitted byadminon Thu, 06/18/2009 - 16:56

Try this code instead:
  1. Private Sub InitNSD()
  2. With NSDataCombo1
  3. .ClearColumn
  4. .AddColumn "CID", 1794.89
  5. .AddColumn "CIN", 2264.88
  6. .Connection = cn.ConnectionString
  7.  
  8. .sqlFields = "cid, cin"
  9. .sqlTables = "cus0001s"
  10. .sqlSortOrder = "cin ASC"
  11.  
  12. .BoundField = "cid"
  13. .PageBy = 25
  14. .DisplayCol = 2
  15.  
  16. .setDropWindowSize 7000, 4000
  17. .TextReadOnly = True
  18. .SetDropDownTitle = "cus0001s Record"
  19. End With
  20. End Sub

i have copied you code and entered the desired table name and connection string but it says the same can you please check for me or give any other solutions plz...... Private Sub NSDataCombo1_Change() With NSDataCombo1 NSDataCombo1.ClearColumn NSDataCombo1.AddColumn "suc", 1794.89 NSDataCombo1.AddColumn "sun", 2264.88 NSDataCombo1.Connection = cn.SysConnect 'NSDataCombo1.Connection = SysConnect---this my connection string NSDataCombo1.sqlFields = "suc, sun" NSDataCombo1.sqlTables = "su007g9" NSDataCombo1.sqlSortOrder = "suc ASC" NSDataCombo1.BoundField = "sun" NSDataCombo1.PageBy = 25 NSDataCombo1.DisplayCol = 2 NSDataCombo1.setDropWindowSize 7000, 4000 NSDataCombo1.TextReadOnly = True NSDataCombo1.SetDropDownTitle = "su007g9 Record" End With End Sub

One is Commented out i have only declared just one the other one is commented out. i am very eagerly waiting for you help sir,
Submitted byadminon Sun, 06/21/2009 - 10:37

In reply to by sadnan

Again, why you put that in the change event? That is not the proper way. You should put that under load even or in any procedure and call it everywhere before you use that control. I think that's where you stuck up.
Submitted byAnonymous (not verified)on Tue, 06/23/2009 - 17:19

In reply to by admin

You Have Sougted out my biggest problem sir you are simply great cheif all the best and god bless
Submitted byvahiduddinon Wed, 06/24/2009 - 14:37

Sir, You Solution worked and i really thank full to you but when i try to a condition it dosnt work i will paste my code here plz have look can i get solution for this With NSDataCombo2 .ClearColumn .AddColumn "Item Code", 6400.89 .Connection = SysConnect .sqlFields = "Select Pc From Sre00rv001 where dn='" & (NSDataCombo1.Text) & "'" .sqlFields = "pc" .PageBy = 25 .DisplayCol = 1 .setDropWindowSize 6500, 3000 .TextReadOnly = False .SetDropDownTitle = "Receiving Voucher Information" End With here it shows blank where as there is data in that condition can u please help me out in this......
Submitted byAnonymous (not verified)on Sat, 06/27/2009 - 16:29

Sir, You Solution worked and i really thank full to you but when i try to a condition it dosnt work i will paste my code here plz have look can i get solution for this With NSDataCombo2 .ClearColumn .AddColumn "Item Code", 6400.89 .Connection = SysConnect .sqlFields = "Select Pc From Sre00rv001 where dn='" & (NSDataCombo1.Text) & "'" .sqlFields = "pc" .PageBy = 25 .DisplayCol = 1 .setDropWindowSize 6500, 3000 .TextReadOnly = False .SetDropDownTitle = "Receiving Voucher Information" End With here it shows blank where as there is data in that condition can u please help me out in this

You cannot put the where clause within sqlFields properties. There is a separate properties for the where clause. See the code below:
  1. With NSDataCombo2
  2. .ClearColumn
  3. .AddColumn "Item Code", 6400.89
  4. .Connection = SysConnect
  5. .sqlFields = "Pc"
  6. .sqlFields = "pc"
  7. .sqlwCondition = "dn='" & NSDataCombo1.Text & "'"
  8. .PageBy = 25
  9. .DisplayCol = 1
  10. .setDropWindowSize 6500, 3000
  11. .TextReadOnly = False
  12. .SetDropDownTitle = "Receiving Voucher Information"
  13. End With
Submitted byAnonymous (not verified)on Tue, 07/14/2009 - 11:37

Sir, can you helpme please?!!! can you give me a sample code for the enrollment System? what is the process to do for this?
Submitted byAnonymous (not verified)on Tue, 07/14/2009 - 11:42

sir help me for the code for Enrollment System!!! thank you more power and GOD Bless!!! I hope that u response about this..
Submitted byAnonymous (not verified)on Tue, 11/03/2009 - 13:23

Hi Is there are way to open the drop down on gotfocus event and set the focus in search field. And then when ever any user presses any key the list should get filtered automatically without the need to press "Enter"

Sorry but you cannot do this without the original source code. Philip Naparan is selling the source code. If you like I can negotiate from him so you will have the source code.
Submitted bykillahbot (not verified)on Fri, 08/03/2012 - 08:36

sir can i use a sql statement for this ocx? im making a sales and inventory system and i would like the datacombo to not show products that are out of stock.. tnx for the help
Submitted bywilliam okwemba (not verified)on Wed, 02/17/2016 - 16:34

when i use the following Private Sub InitNSD() With NSDataCombo1 .ClearColumn .AddColumn "CID", 1794.89 .AddColumn "CIN", 2264.88 .Connection = cn.ConnectionString .sqlFields = "cid, cin" .sqlTables = "cus0001s" .sqlSortOrder = "cin ASC" .BoundField = "cid" .PageBy = 25 .DisplayCol = 2 .setDropWindowSize 7000, 4000 .TextReadOnly = True .SetDropDownTitle = "cus0001s Record" End With End Sub connection string :=Driver={SQLServer};Data Source=IBMIS;SERVER=" & sServerName & "; Database=" & sDBName & ";Uid=" & sUserName & "; Pwd=" & sPassword & ";" am connecting to SQL data base but still gives me the as follows. [Microsoft][ODBC SQL SERVER DRIVER][SQL SERVER] Login failed for user. kindly help
Submitted byJun Tan (not verified)on Tue, 01/29/2019 - 10:33

Hello Sir. How can you connect NSdatacombo to mysql to load data. its says error in driver

Add new comment