Hi..
i have a problem here...
i have a master table called casemaster and in tht i have one combobox called courtId and its filling from the court table.. i need to make a textbox infront of tht and it has to fill the court name from the court table... whenever the user click on the courtid in tht dropdown of combobox tht name of the court automatically has to appear in tht textbox... how can i make a link between the combobox and the textbox... both of them has to be filled from my court table...
can anyone give me a code sample...
plz i need a help here and very urgent
thank u very much
15 6326
you need to pass the court_id from the combo to the db query dunamically and from that fetch the court name.
You should implement a method that handles the ComboBox's Click Event.
The Click event occurs whenever the user clicks ComboBox.
From there you can determine which item has been selected, you can retrieve the court name from the database, and put the court name in the text box.
thank u very much for ur help.. bt can u give me any code sample plz
i wil appricate tht
thank u in advance
ok i m putting this code bt not working and my textbox is empty..
i dont knw if i m doing rit... when i debug the line which is bold it shows "" and in my textbos it comes 0 ..... where i have to change
can u help me here plz
thank u -
Private Sub cmbCourtId_Click()
-
txtCourtId.Text = GetCorrespodingField("Court", "Courtid", "courtid", cmbCourtId, False)
-
Dim cn As String
-
If cmbCourtId.Text = true Then
-
'the following line is bold
-
cn = Val("select courtname from court where courtid = cmbcourtid.text")'<-----bold line---
-
Text1.Text = cn
-
End If
-
End Sub
i don't understand your code .
what does GetCorrespodingField do ?
the GetCorrespodingField is filling the combobox from my court table to my master table... tht is not the problem the if loop is the problem... the line which is bold is coming zero... how can i get the value of courtname in tht line?
can anyone check my code and tel me wht changes i have to make in tht line.... need help here
try this -
rs.Open "select court_name from court where court_id = '" & combo1.text & "'", con, adOpenDynamic, adLockOptimistic
-
next populate the textbox from recordset.
i dont think i need to open the rs here... its a simple combo box and textbox... i am changing my code to this bt rhe bold line is telling me "type mismatch"
can anyone tel me why? -
Private Sub cmbCourtId_Click()
-
Dim Rs As New ADODB.Recordset
-
txtCourtId.Text = GetCorrespodingField("Court", "Courtid", "courtid", cmbCourtId, False)
-
Dim cn As String
-
If cmbCourtId.SelectedIndex <> -1 Then
-
'following line is bold
-
cn = Str("select courtname from court where courtid = " & cmbcourtid.text)
-
Text1.Text = cn
-
End If
-
End Sub
how have you planned to fetch data from database without opening the recordset ?
if i open the recordset also still i m getting error
i did wht u told me to do bt still the text is not showing in my textbox...
tht is my problem
i opend the recordset as u told me bt the textbox is empty
tel me how to get it in the textbox -
If cmbCourtId.Text <> -1 Then
-
Rs.Open ("select courtname from court where courtid = '" & cmbCourtId.Text & "'"), adOpenDynamic, adLockOptimistic
then after tht wht i have to do??? whtever i m doing it tels me type mismatch
Hi,
You need to specify Connection object here :
Rs.Open ("select courtname from court where courtid = '" & cmbCourtId.Text & "'"), Conn, adOpenDynamic, adLockOptimistic
Regards
Veena
Hi Veena,
Ok i wil do tht bt then how can i get tht in my textbox?
i have combobox called cmbcourtid and by selecting the index from tht i want the particular courtname appear in my textbox called text1 automatically.. i open the connection bt then how i get tht in my textbox?
can u help me in tht... whtever i m trying is telling me type mismatch... coz its a string conn i can not put its giving me error as variable not define.. i put Db its working.. and the line after tht when i want to assign tht to a variable to get the courtname on the textbox.. how should it should be??? is my line rit after the rs.open??? i dont knw how it should be?
can u help in tht? coz cn is a string
thank u -
Private Sub cmbCourtId_Click()
-
Dim Rs As New ADODB.Recordset
-
txtCourtId.Text = GetCorrespodingField("Court", "Courtid", "courtid", cmbCourtId, False)
-
Dim cn As String
-
If cmbCourtId.Text <> -1 Then
-
If Rs.State = adStateOpen Then Rs.Close
-
Rs.Open ("select courtname from court where courtid = '" & cmbCourtId.Text & "'"), Db, adOpenDynamic, adLockOptimistic
-
-
cn = Rs.Fields( ).Value
-
-
Text1.Text = cn
-
Text1.Refresh
-
End If
-
End Sub
I think i am wasting my time with you.
you seem to lack the basic knowledge of database handling in VB.
better you go through the database related articles in the insight section of VIsual Basic for some sample code.
i got the thing long time back..
and u didnt waste ur time wit me i did everything exactly u told me and got the answer
thanks for all ur help
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Lyn |
last post by:
Hi,
Can anyone tell me how the initial value displayed in Combo Box is
determined when a form is opened?
I am loading the dropdown from one field ("CategoryName") of a table, with
"ORDER BY ". ...
|
by: Jeff Mason |
last post by:
I'm observing some strange behavior when I use a bound combo box in conjunction with
the combo's anchor property. I define a form which contains just a textbox and a
combo box. The text box is...
|
by: Ron L |
last post by:
I have a dataset whose source is a SQL 2k stored procedure that I am trying
to display in a datagrid. This datasource has 4 columns that I am
interested in here, a text column and 3 value columns...
|
by: Hans Merkl |
last post by:
Hi,
Can anybody recommend a combo box control (textfield + dropdown list) for
ASP.NET?
I have looked at some products and it seems they all have some problems. I
haven't yet found a combo box...
|
by: Edwinah63 |
last post by:
Hi everyone,
Please let there be someone out there who can help.
I have two BOUND combo boxes on a continuous form, the second being
dependent on the first. I have no problem getting the...
|
by: debbie |
last post by:
I have three combo boxes on a subform. I have tried setting them up so
that when the user clicks in the combo box the curser moves to the
left. I have searched the posts and can find nothing that...
|
by: Swinky |
last post by:
I am trying to make a combo box dependent on a text box. I cannot get
the combo box to pull the related data from the text box. I have been
all over this user group & have tried several versions...
|
by: Wayne |
last post by:
I have a combo box and a text box on a form. When I choose a value
from the combo box, I want it to be added to the textbox. I'm able to
do this by using the following code when I click the combo...
|
by: Ruthenfods Tellez |
last post by:
I have an application in asp; in my form I have a combo and a textbox, the
combo is fill in from a database query. I cannot do the following: when
selecting an item from the combo, it should send...
|
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
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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: 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...
|
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: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |