473,386 Members | 1,867 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.

populated combo box value by a SQL SELECT statement.

kirubagari
158 100+
My form displays a combo box populated by a SQL SELECT statement. The user
will select a row from the combo box. I then want the value in a field of the
row selected in the combo box to be used as the selection criteria in a SQL.Attach is my code but incomplete..Dear experts kindly help
Expand|Select|Wrap|Line Numbers
  1. Private Sub coReasonCode_Click()
  2.  
  3.     Dim Sreasoncode As String
  4.     Dim sSQL As String
  5.     Dim oSQL As clsSQL
  6.     Dim cRow As FwAttributes
  7.     Dim cRows As Collection
  8.  
  9.     Sreasoncode = coReasonCode.text
  10.  
  11.     sSQL = "select descs,user,brief_desc from cim_tbl_multiplehold" & _
  12.             " where comment_code = Sreasoncode "
  13.  
  14.     Set oSQL = New clsSQL
  15.     oSQL.Server = "CARdefault"
  16.  
  17.     oSQL.SqlCall = sSQL
  18.     Set cRows = oSQL.SqlResult
  19.  
  20. End Sub
  21.  
statement.
Mar 31 '11 #1
1 1712
VijaySofist
107 100+
Hi kirubagiri,

In your code plz try the following changes.

If the comment_code field is numeric use this
Expand|Select|Wrap|Line Numbers
  1. " where comment_code = " & Val(Sreasoncode) 
Or else the comment_code is text then use this below
Expand|Select|Wrap|Line Numbers
  1. " where comment_code = '" & Sreasoncode & "'"

All the Best

Regards
Vijay.R
Apr 4 '11 #2

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

Similar topics

7
by: Guy Hocking | last post by:
Hi there, I have a problem in my ASP/SQL Server application i am developing, i hope you guys can help. I have a ASP form with list boxes populated by SQL tables. When a user selects a value...
8
by: Adam Nemitoff | last post by:
Is is possible to construct a SELECT statement that contains a WHERE clause that uses the value from a column in the "next" row? ie. given a table with a single field named "myField" with the...
2
by: Scott | last post by:
If I click the "Update" button on my form below, I can retrieve the value of my combo by using code in the FORM RESULTS section below. Therefore, if I choose the "Inside" option in my combo, I...
3
by: shamaila | last post by:
in my windows form,for search,two combo boxes are provided.the first one gives the table names and in second combo box the respective fields are provided ,by selecting any field the user enters the...
1
by: sumanthdivvela | last post by:
<select name="cityName" class="CLiKSformfield" id="IdfbCity" onChange="javascript:addCity(this);"> <option value="ALL">Select Location</option> <option value="1001" >...
2
by: johnlarson | last post by:
I am trying to populate a datagrid from a select statement that contains variables. I can query the dbf file and get the whole file but when I try a select statement with variables from text box and...
1
by: ebo2006 | last post by:
There are two combo boxes in my form: CORP and CLASS. The WHERE clause of the SELECT statement in the Row Source Property of the CLASS combo box works only every time I start the form. It does not...
0
by: Richard Silvers | last post by:
Hi, I'm trying to find the most efficient way to access DB2 data on z/OS DB2 V8. Any suggestions would be welcomed . . . Situation: 1. Converting a VSAM file to DB2 on z/OS 2. VSAM file...
2
by: kxyz | last post by:
Hello everyone, I need help with a stored procedure or two. My stored procedures are supposed to check if a certain record exists. If it does exist, then I select everything from that row, as...
3
by: micky125 | last post by:
Hey guys I have been checking the forum for a way to populate a second select field depending on the choice made from the first one. Basically i am working on projects and the delays that occur. The...
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?
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.