Hello,
I have a form with a listbox that displays a list of records from a SQL table. When one of these is selected, another listbox is populated with data from a SQL table that is linked to the 1st table.
I'm not sure what I'm doing wrong, but when you first click on a value in listbox1, it shows a list of values in listbox2 that are linked with the PREVIOUS value in listbox1, (basically the ID of the listbox item - 1) then, if you click the listbox1 value AGAIN, it shows the correct records.
I'm using the listbox1_SelectedIndexChanged() sub.
Is this where the problem lies?
Thanks,
amber 7 1475
Post your code so we can see what you're up too.
It could be anything but what you're trying to do is very simple
so when we've seen your code you'll get an answer lickety split.
At least you've identified a pattern to the bug so you probably
already have 3/4 of the answer yourself in such a simple scenario.
Post some code and we'll get it sorted.
Richard
Thanks Richard
This doesn't seem to want to work for me. I tried replying a few times last week, and creating a new post...but they never appeared
So here goes again..
Private Sub lBoxCP_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lBoxCP.SelectedIndexChange
'load cutblock lis
lBoxCB.DataSource = Nothin
Me.txtBox1.DataBindings.Clear(
Me.txtBox2.DataBindings.Clear(
Me.txtBox3.DataBindings.Clear(
OleDbDataAdapter3.SelectCommand.Parameters("ID_CUT TING_PERMIT").Value = txtCPID.Tex
DsCutBlock1.Clear(
OleDbDataAdapter3.Fill(DsCutBlock1
lBoxCB.DataSource = DsCutBlock
lBoxCB.DisplayMember = "TDT_CUT_BLOCK.STR_BLOCK_NUMBER
Me.txtBox1.DataBindings.Add(New System.Windows.Forms.Binding("Text", Me.DsCutBlock1, "TDT_CUT_BLOCK.STR_BLOCK_NUMBER")
Me.txtBox2.DataBindings.Add(New System.Windows.Forms.Binding("Text", Me.DsCutBlock1, "TDT_CUT_BLOCK.NUM_AREA_APPROVED")
Me.txtBox3.DataBindings.Add(New System.Windows.Forms.Binding("Text", Me.DsCutBlock1, "TDT_CUT_BLOCK.STR_LOCATION")
End Su
Hi Amber,
I will not say it is the only thing, but this is one of the things that is
not correct. Me.txtBox3.DataBindings.Add(New
System.Windows.Forms.Binding("Text", Me.DsCutBlock1,
"TDT_CUT_BLOCK.STR_LOCATION"))
You have to bind it to the table not to the dataset.
I asume it is a typed dataset so just the dot and than the table name,
Although probably
DsCutBlock1.tables(0) will works also if you have only one table.
I hope this helps,
Cor
Hi Amber,
You are right, I did not see the dot between the second parameters.
I did look very long and see not direct something wrong, but in your problem
you are talking about listbox1 and listbox2 and it is very hard to find what
goes wrong.
Can you tell it again but now with the right names?
Cor
> I did look very long and see not direct something wrong, but in your
problem
problem = problem description (the first message)
I appreciate all your help
Having problems posting again...my most recent reply never did show up..
Okay,
My original message (with edits)
I have a form with a listbox (lBoxCP) that displays a list of records from a SQL table. When one of these is selected, another listbox (lBoxCB) is populated with data from a SQL table that is linked to the 1st table
I'm not sure what I'm doing wrong, but when you first click on a value in listbox1 (lBoxCP), it shows a list of values in listbox2 (lBoxCB) that are linked with the PREVIOUS value in listbox1 (lBoxCP), (basically the ID of the listbox item - 1) then, if you click the listbox1 value AGAIN, it shows the correct records
I'm using the lBoxCP_SelectedIndexChanged() sub
My Code
Private Sub lBoxCP_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lBoxCP.SelectedIndexChange
'load cutblock lis
lBoxCB.DataSource = Nothin
Me.txtBox1.DataBindings.Clear(
Me.txtBox2.DataBindings.Clear(
Me.txtBox3.DataBindings.Clear(
OleDbDataAdapter3.SelectCommand.Parameters("ID_CUT TING_PERMIT").Value = txtCPID.Tex
DsCutBlock1.Clear(
OleDbDataAdapter3.Fill(DsCutBlock1
lBoxCB.DataSource = DsCutBlock
lBoxCB.DisplayMember = "TDT_CUT_BLOCK.STR_BLOCK_NUMBER
Me.txtBox1.DataBindings.Add(New System.Windows.Forms.Binding("Text", Me.DsCutBlock1, "TDT_CUT_BLOCK.STR_BLOCK_NUMBER")
Me.txtBox2.DataBindings.Add(New System.Windows.Forms.Binding("Text", Me.DsCutBlock1, "TDT_CUT_BLOCK.NUM_AREA_APPROVED")
Me.txtBox3.DataBindings.Add(New System.Windows.Forms.Binding("Text", Me.DsCutBlock1, "TDT_CUT_BLOCK.STR_LOCATION")
End Su
Thanks
Ambe
Hi Amber,
Two things looks strange to me (I do not see all your code (do not send it,
because in a newsgroup that is mostly to much). lBoxCB.DataSource = Nothing
Why do you do this on this place and not later, does that not destroy your
data (I think not but it could be the next error)
OleDbDataAdapter3.SelectCommand.Parameters("ID_CUT TING_PERMIT").Value =
txtCPID.Text
What is this Text I see it nowhere in your explanation (could misreaded it
of course).
(If you have linked it to lBoxCB it should go wrong when you set the
datasource of that to Nothing)
Maybe we are something further?
Cor This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: gasturbtec |
last post by:
please help im new at access programming and i just got this project
dropped in my lap because the old programmer quit. i've been doing ok
so far but now i need to add code to an existing database...
|
by: Josema |
last post by:
Hi,
My problem is the next one (in a windows application):
- I have a class derived from collectionbase to fill with persons object
(id, name) from database.
- I have a ListBox wich datasource...
|
by: Stimp |
last post by:
I have a listbox of values that I populate from a database.
I want the user to be able to re-order the list
(by first selecting an item and then clicking 'up' or 'down' buttons)
and then save...
|
by: Dennis |
last post by:
I hoping you might be able to help me with a small problem. I have
made an application that links a VB.NET program to a database. After
many failed attempts and reading I can add, delete, navigate...
|
by: lance2001 |
last post by:
Hi,
After viewing the entire Visual Basic 2005 Express Edition for
Beginners video series, I have begun building a database driven
application that will make use of listbox1 (multi-select)...
|
by: Jay Ruyle |
last post by:
I'm trying to figure out a way to list several items in a listbox and let
the user select any number of items in the listbox. I have tried to code in
the items as bitwise items but all it stores...
|
by: BerkshireGuy |
last post by:
Ok - I have something I need help with and I am going to do my best to
explain the siutation.
I have a group of underwriters who can underwrite certain products.
Some products they cannot...
|
by: Sunray |
last post by:
I have a form called the sales form and i have 2 sets of listboxes
So what happens is. i add items form the bottom set of list boxes which are bound to a data base to the top set of list boxes which...
|
by: aiswarya |
last post by:
I've a table named student in my database.In it there are 7 columns .Now, in my form, when I click my table name, the name of columns should be displayed in
one listbox ie in listbox1. Again, when...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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:
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: 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: 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: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |