|
-
Sep 14th, 2000, 06:39 PM
#1
Thread Starter
Member
Here's a weird one that was driving me crazy today...
I have a dbCombo bound to a data control (Data1) for a table that is just basically just an ID & Desc. The dbCombo.boundcolumn is set to the ID and the dbCombo.listfield is set to the Desc.
In the Change event I do this:
Data2.RecordSource = "select * from DifferentTable where ID_Field=" & dbCombo.BoundText
Data2.Refresh
Now, this works fine when I run the app from the IDE, but if I put a break point on the Data2.RecordSource line, the value of BoundText contains the value of the Desc field (which of course causes the line to fail). Strange...
I am running VB6 SP4
~Michael Kizer
http://Michael.Kizer.ws
The Ivory Gate Of Dreams ~ http://www.ivorygate.com
-
Sep 15th, 2000, 02:07 AM
#2
New Member
Why the Change Event?
I understand your binding to the Data Control "Data1", that is the ordinary thing. However what do you try to do with the Change event and the Data2?
I would guess the reason why you did not get a reply earlier is that nobody understood what you actually want to do. Do you want to reload the same combo box from a different source, when the user has done a first selection?
-
Sep 15th, 2000, 09:25 AM
#3
Thread Starter
Member
I can elaborate...
the dbCombo in question is populated by Data1. Once the user chooses an item in that combo, I use that selection as the where clause argument for the select statement in Data2's RecordSource. I then use Data2 to populate a grid. THe user could at anytime go back up to the original dbCombo and change their selection, hence using the Change event.
Hope that makes it a bit clearer.
~Michael Kizer
http://Michael.Kizer.ws
The Ivory Gate Of Dreams ~ http://www.ivorygate.com
-
Sep 18th, 2000, 12:48 AM
#4
New Member
In that situation I use the following:
Data1.Recordset.Move dbCombo.SelectedItem - 1, 1
strSQL = "SELECT ... : _
& "WHERE ...=" & Data1.Recordset!ID
Data2.Recordsource = strSQL
Data2.Refresh
It is not elegant at all and I suppose there should be better, but at least it works. Please criticise me freely and thanks for your elaboration.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|