473,386 Members | 1,754 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Fetch the data from table if combo box value is choose (drop down list)

kirubagari
158 100+
I'm having the issue where unable fetch the data if the value in combo box is chosen.
The problem is when user choose the value from combo box,i want the code fetch for the rest data from the table.

Kindly help how i can work on this..Attach is my code
Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Function ListOfCommendCode(ByRef poutcolCommendCode As FwStrings, ByRef poutstrErrDesc As String) As Long
  3.  
  4. 2        Dim lngRetCode As Long
  5.  
  6. 4        Dim sSQLstatement As String
  7.  
  8. 6        Dim objSQL As clsSQL
  9. 7        Dim cRow As FwAttributes
  10. 8        Dim vColValue As Variant
  11. 9        Dim Index As Integer
  12.  
  13. 11       On Error GoTo ErrorHandler
  14.  
  15. 13       'Allocate Memory
  16. 14       Set objSQL = New clsSQL
  17.  
  18. 16       ' Initialization
  19. 17       If poutcolCommendCode Is Nothing Then Set poutcolCommendCode = WIP.CreateFwStrings
  20.  
  21. 19       ' Get list of area
  22. 20       sSQLstatement = "SELECT comment_code " & _
  23.                   "FROM CIM_TBL_MULTIPLEHOLD " & _
  24.                   "WHERE STATUS ='Hold ' "
  25.  
  26. 25       ' Access database
  27. 26       objSQL.Server = "CATdefault"
  28. 27       objSQL.SqlCall = sSQLstatement
  29.  
  30. 29       If objSQL.SqlResult.Count > 0 Then
  31. 30           For Each cRow In objSQL.SqlResult
  32. 31               For Index = 1 To cRow.Count
  33. 32                   vColValue = Trim(cRow.Item(Index))
  34. 33                   poutcolCommendCode.Add vColValue
  35. 34                  coReasonCode.AddItem vColValue
  36. 35               Next Index
  37. 36           Next
  38. 37       End If
  39.  
  40. 39       lngRetCode = 0
  41. 40       GoTo ExitHandler
  42.  
  43. 42 ErrorHandler:
  44. 43       lngRetCode = Err.Number
  45. 44       poutstrErrDesc = Err.Description
  46. 45       Trace ("Fail to get list of route area due to Error: " & CStr(Err.Number) & " " & Err.Description)
  47.  
  48. 47 ExitHandler:
  49. 48       ' Release the referenced obejct
  50. 49       If Not objSQL Is Nothing Then Set objSQL = Nothing
  51.  
  52. 51       ' Set the function return value
  53. 52       ListOfCommendCode = lngRetCode
  54. End Function
  55.  
  56. Private Sub Form_Load()
  57.  
  58. 2       CenterForm Me
  59.  
  60.         Dim lngRetCode As Long
  61.         Dim poutcolCommendCode As FwStrings
  62.         Dim poutstrErrDesc As String
  63.              ' Clear the original text
  64. 18       coReasonCode.text = ""
  65.  
  66. 34                ' Dropdown list for area
  67. 35       lngRetCode = ListOfCommendCode(poutcolCommendCode, poutstrErrDesc)
  68. 36       If lngRetCode <> 0 Then
  69. 37           Err.Raise lngRetCode, , poutstrErrDesc
  70. 38       End If
  71.  
  72. 40       GoTo ExitHandler
  73.  
  74. 42 ErrorHandler:
  75. 43       MsgBox "Error encounter during Form Load: " & Err.Description
  76.  
  77. 45 ExitHandler:
  78.  
  79. End Sub
  80.  
  81.  
  82.  
  83.  
  84.  
Mar 31 '11 #1
0 962

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Joey Liang via DotNetMonster.com | last post by:
Hi all, I am new to ASP.NET, i have met some problems in binding data from a table of database to a dropdown list control. Anyone knows how to do it?if possible can rougly write the codes or any...
2
by: Ren | last post by:
Hi all, I am a bit new to PHP and SQL so this may seem like a dumb question. I have already created a drop down list as part of a form which is automatically populated with values taken from a...
0
by: ayneekeaw | last post by:
When I click the update button/link at the Gridview to update the data from drop down list into the SQL. The selected value of drop down list change to default value. How can I fix this problem
2
by: programmerboy | last post by:
This questions is pretty easy, but let me ask since I wasn't able to figure it out. why I am always getting the first value from DropDownList when I have ddlStates.SelectedItem.Value; ...
2
by: leeperman | last post by:
In Dreaweaver I cannot filter my database results to display only specific data that is retrieved from mulptile drop down list on my search page. The drop down list selections are posted to my...
7
by: jtmphp | last post by:
I have a drop down/list and am using a php and a mysql table to store my values. I am displaying an update page that already has the user's number stored in it. I want to default their current number...
1
by: nithingujjar | last post by:
Hi, I need to to hide a field"addr_state1" based on a value in the drop down list field called "addr_country".i.e.,if addr_country.value=="in" then hide addr_state1 else , and if the value in the...
3
by: maminx | last post by:
I have this script... var td = document.createElement('td'); var p = document.createElement('p'); var label = document.createElement('label'); var span =...
1
by: dmj07 | last post by:
Hi all, I was wondering of an easy way to set the selected value of a drop down list by using a value retrieved from the database. Here is my code: SqlCommand cmdUser = new...
1
by: slickuser | last post by:
Hi, How can I get the selected value from the drop down menu list inside the GridView command when the user click updated button on that row? Thanks. <asp:BoundField DataField="NAME"...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.