SunQuest
           Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
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  
Old August 14th, 2003, 01:20 PM
jayrye715 jayrye715 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 35 jayrye715 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
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:

Reply With Quote
  #2  
Old August 15th, 2003, 07:56 AM
Onslaught's Avatar
Onslaught Onslaught is offline
/(bb|[^b]{2})/
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Nov 2001
Location: Somewhere in the great unknown
Posts: 4,834 Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Day 23 h 30 m 30 sec
Reputation Power: 88
Send a message via ICQ to Onslaught
What are you trying to do in the onChange event?

Reply With Quote
  #3  
Old August 15th, 2003, 08:15 AM
jayrye715 jayrye715 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 35 jayrye715 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
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.

Reply With Quote
  #4  
Old August 15th, 2003, 08:27 AM
Onslaught's Avatar
Onslaught Onslaught is offline
/(bb|[^b]{2})/
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Nov 2001
Location: Somewhere in the great unknown
Posts: 4,834 Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Day 23 h 30 m 30 sec
Reputation Power: 88
Send a message via ICQ to Onslaught
I don't mean an explanation, but what code are you doing in the onChange event?

Reply With Quote
  #5  
Old August 15th, 2003, 08:30 AM
jayrye715 jayrye715 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 35 jayrye715 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
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.

Reply With Quote
  #6  
Old August 15th, 2003, 09:12 AM
Onslaught's Avatar
Onslaught Onslaught is offline
/(bb|[^b]{2})/
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Nov 2001
Location: Somewhere in the great unknown
Posts: 4,834 Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Day 23 h 30 m 30 sec
Reputation Power: 88
Send a message via ICQ to Onslaught
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.

Reply With Quote
  #7  
Old August 15th, 2003, 09:15 AM
jayrye715 jayrye715 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 35 jayrye715 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
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.

Reply With Quote
  #8  
Old August 15th, 2003, 09:23 AM
Onslaught's Avatar
Onslaught Onslaught is offline
/(bb|[^b]{2})/
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Nov 2001
Location: Somewhere in the great unknown
Posts: 4,834 Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Day 23 h 30 m 30 sec
Reputation Power: 88
Send a message via ICQ to Onslaught
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.

Reply With Quote
  #9  
Old August 15th, 2003, 09:24 AM
jayrye715 jayrye715 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 35 jayrye715 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
I will try this and see if it works thanks for your help I will let you know what happens

Reply With Quote
  #10  
Old August 15th, 2003, 09:33 AM
jayrye715 jayrye715 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 35 jayrye715 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
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

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > Need help with Datacombo and Text box


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway