|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
Need help with Datacombo and Text box
I need some help. Here is what I have.
I have a form with a datacombo box that has a list and also I have a text box that is on the form. what I need to Happen is when a selection is picked. I need information in a table to populate the text box that goes with each selection. Example: Datacombo is associated with a table textBox is not associated with a table in the table I have two columns Column1 Column2 A A1 B B1 Column1 is the datacombo box Column2 is what I need to go in the text box. so if I select B I need to have The textbox have B1 I am trying to use on change function but this doesn't seem to work. If any one could help that would be great. Let me thank you in advance.
__________________
Jay Rye :Cool: |
|
#2
|
||||
|
||||
|
What are you trying to do in the onChange event?
|
|
#3
|
|||
|
|||
|
Example:
Table1 col1,col2 Table2 Col1,col2 My datacombo is setup with the a list from Table2(col1) and is bound to Table1(col1. My text box is bound to table1(col2) What I need is that when someting is picked in the datacombo from Table2(col1) it populates the textbox from Table2(Col2). I have an update command that takes care of writing to the database. So when the textbox is populated with the information from Table2(col2) the update command will write it to the Table1(col2). I hope this helps in understanding what I am trying to do. Last edited by jayrye715 : August 15th, 2003 at 08:18 AM. |
|
#4
|
||||
|
||||
|
I don't mean an explanation, but what code are you doing in the onChange event?
|
|
#5
|
|||
|
|||
|
Sorry
In the on change Event I have this code text1.text = adoRS!Web This code works for the first one when it loads but will not change after that. |
|
#6
|
||||
|
||||
|
do you have adoRS still set?
Another solution would be to do a select in the table according to what was selected in the combo box and then put the value returned from the query into the text box. |
|
#7
|
|||
|
|||
|
I am not sure I understand. I have a list of over 50 Items and that would be a long select case.
I was wondering if I could do this if I could do a query that resets the text in the on change event. |
|
#8
|
||||
|
||||
|
That's what I'm talking about.
In the change event get the value of the combo box (Combobox1.Text) and use that in a select statement. i.e. sql = "select your_column from your_table where first_column='" & combobox1.text & "'" then execute the query and set the column value returned from the resultset as the value of the text box. |
|
#9
|
|||
|
|||
|
I will try this and see if it works thanks for your help I will let you know what happens
|
|
#10
|
|||
|
|||
|
I tried this code listed below and it works thanks for leading me in the right direction.
Dim sql As String sql = "select web from databases where Full_Database = '" & DACFields(0).Text & "'" Set adoRS6 = New Recordset adoRS6.Open sql, conn txtFields.Text = adoRS6!Web |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > Need help with Datacombo and Text box |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|