Hellow,
I am trying to make Railway time table in excel through Visual basic. I have 2 combo Boxes (From and To)& Multiple Text Boxes to populate Train No, Train Name, Arrival & departure (TextBox 1-2-3-4) respectively. When I select Combo box 1 & 2, data is populated in all cited 4 text box correctly(1-2-3-4). But in text box no. 5-6-7-8/9-10-11-12 etc are also populated the same data as appear in text box no 1-2-3-4. Coding which I create is as below. - 'Get Items to ComboBox2 based on ComboBox1 selection
-
Private Sub ComboBox1_Change()
-
-
'Variable Declaration
-
Dim iCnt As Integer
-
-
'Clear Combobox2 before loading items
-
ComboBox2.Clear
-
-
With ComboBox2
-
Select Case ComboBox1
-
Case "Nagpur"
-
.AddItem "Ambala"
-
.AddItem "Amgaon"
-
.AddItem "Agra Cantt"
-
.AddItem "Amravati"
-
.AddItem "BADNERA JN"
-
.AddItem "BADSHAHNAGAR"
-
.AddItem "BADSHAHNAGAR"
-
.AddItem "BAGBAHRA"
-
-
End Select
-
End With
-
-
End Sub
-
-
'Get Train No based on ComboBox2 selection
-
Private Sub ComboBox2_Change()
-
-
'Variable Declaration
-
Dim iRow As Integer
-
iRow = 3
-
-
'Clear Combobox2 before loading items
-
TextBox1.Text = ""
-
-
'Get Train No based on ComboBox2 selection
-
Do
-
iRow = iRow + 1
-
Loop Until ComboBox2.Text = Sheets("Data").Cells(iRow, 3)
-
TextBox1.Text = Sheets("Data").Cells(iRow, 4)
-
TextBox2.Text = Sheets("Data").Cells(iRow, 5)
-
TextBox3.Text = Sheets("Data").Cells(iRow, 6)
-
TextBox4.Text = Sheets("Data").Cells(iRow, 7)
-
TextBox5.Text = Sheets("Data").Cells(iRow, 4)
-
TextBox6.Text = Sheets("Data").Cells(iRow, 5)
-
TextBox7.Text = Sheets("Data").Cells(iRow, 6)
-
TextBox8.Text = Sheets("Data").Cells(iRow, 7)
-
-
End Sub
-
Private Sub TextBox1_Change()
-
End Sub
-
Private Sub TextBox2_Change()
-
End Sub
-
Private Sub TextBox3_Change()
-
End Sub
-
Private Sub TextBox4_Change()
-
End Sub
-
Private Sub TextBox5_Change()
-
End Sub
-
Private Sub TextBox6_Change()
-
End Sub
-
Private Sub TextBox7_Chnge()
-
End Sub
-
Private Sub TextBox8_Change()
-
End
Request you kindly help. Thanks for your active co-operation.
Regards,
Bhawesh
1 1983
Bhawesh,
Lines 45-48 of your code block above is assigning the values from Columns 4-7 (which are the same values assigned to Text Boxes 1-4). Perhaps you meant to assign columns 8-11?
Also, I see no references in your Code to Text Boxes 9-12, so I am not sure how they are getting updated.
Just as a side note, Lines 11-22 could get quite cumbersome as you add more and more Departure/Destination cities. Have you thought of having this data elsewhere on the Spreadsheet?
Better yet, have you thought of creating an MS Access Database? (yeah, that's just a personal plug, since that is more of my forte)
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Steve Zifah |
last post by:
Im just a beginner using MS Access 2002. I have a database set up
with only 1 table and need help searching the database. I would like
the search to be similar to a web search interface.
I...
|
by: Paul |
last post by:
I have some option boxes and combo boxes that looks up values on a
separate table (i.e. campus table with campusID & campus name fields)
When I choose a selection from the combo box, it puts the...
|
by: Aravind |
last post by:
Hi folks.
I have 2 forms, frmBorrow and frmHistory
frmBorrow has an unbound multi-column combo box (cboMember) and 7
unbound text boxes (MemNo, MemName, MemIC, MemType, CourseFaculty,
Borrow,...
|
by: Brian Mitchell |
last post by:
Hello, I have a weird problem with my Visual Basic. The text in list boxes,
buttons and message boxes are missing when I run the program. Everything
looks fine at design time but somewhere when I...
|
by: winky10 |
last post by:
From a newbie.
MSAccess 2000. I have a form with checkboxes and text boxes bound to their respective fields in a table. Using a query, I am able to create a report based on those checked boxes. ...
|
by: janbazamin |
last post by:
Hi Dear.
I am making time table application in ASP.NET i am facing some problem i am adding Start time, End Time In Database. on some date. if i again select same date and stat time and end time. i...
|
by: jw01 |
last post by:
I have a form in which there is one combo box and three text boxes:
Combo Box:
-> Item A
-> Item B
-> Item C
TextBox1:
TextBox2:
...
|
by: chaosdl |
last post by:
Hello,
I am currently using Visual Basic 2005 express edition with a MS Access database. I have made a "Contacts" Form, where the user will be able to enter a members surname and press an OK...
|
by: Marianne160 |
last post by:
Hi,
I know there are various answers to this problem available on the web but none of them seem to work for me. I am using Access 2003 to make a form to look up data from a table. I have so far...
|
by: Denielle |
last post by:
Currently I have a form that has bound text boxes and combo boxes on it. Some of the combo boxes are pulling the information from other tables and some are manually entered in. I would like to...
|
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,...
|
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$) {
}
...
|
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...
|
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...
|
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: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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: 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,...
|
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...
| |