|
-
Feb 27th, 2001, 07:59 PM
#1
Thread Starter
Hyperactive Member
I am tring to use a data combo box to look up a record in my data base. I have it bound to a field "CustomerName" in my data enviroment but when I select on of the customers names I can't get it to bring up the rest of the fields in the Record that are linked the same data enviroment and command. The source of my datadase is Microsoft Jet OLE DB 4.0 Provider. Im sure Its just a code issue but, I not sure .
If anyone can help I would greatly appreciate it.
Thanks..
-
Feb 27th, 2001, 09:04 PM
#2
Make sure the Rowsource and Listfield (maybe RowMember as well) are set right to put the data in the drop down list. Depending on what you are doing you probably don't need to set the Datasource, member and field props. Then the click event for the dcbo should look like this:
Code:
Private DataCombo1_Click(Area as integer)
If area=2 then
adodc1.recordset.bookmark=datacombo1.selecteditem
End if
End Sub
This code assumes there is an ado control named adodc1 with the info in it.
-
Feb 27th, 2001, 09:37 PM
#3
Thread Starter
Hyperactive Member
About your code?
I modified your code to :
Private Sub DataCombo1_Click(Area As Integer)
If Area = 2 Then
DataEnvironment1.rsCommand1.Bookmark = DataCombo1.SelectedItem
End If
End Sub
My DataCombo was working in the aspect that it listed the contents of "CustomerName" and when I selected a different CustomerName My TextBox "CustomerName" changed But the rest of the information on my form didn't update.
This is how I am set up:
txtFields(0)
DataSource = DataEnviroment1
DataMember = Command1
DataField = CustomerName
txtFields(1)
DataSource = DataEnviroment1
DataMember = Command1
DataField = Address
txtFields(2)
DataSource = DataEnviroment1
DataMember = Command1
DataField = City
txtFields(3)
DataSource = DataEnviroment1
DataMember = Command1
DataField = State
txtFields(4)
DataSource = DataEnviroment1
DataMember = Command1
DataField = Zip
DataCombo1
BoundColumn = CustomerName
DataSource = DataEnviroment1
DataMember = Command1
DataField = CustomerName
ListField = CustomerName
RowSource = DataEnviroment1
RowMember = Command1
I am running SP4
If you have any other suggestions that might help I would appreciate it...
Thanks,
Jason
-
Feb 28th, 2001, 12:06 AM
#4
Thread Starter
Hyperactive Member
I got it to work
My DataEnviroment Connetion is liked to a MS Access database. I went into Access and created a Query for my table which is Command1 then I went into my DataEnviroment and added a new Command "Command3" and set database object to "View" and object Name to "name of my Query" and made no relation. Then I changed my DataComboBox settings to ->>
BoundColumn = CustomerName
DataSource = DataEnviroment1
DataMember = Command3
DataField = CustomerName
ListField = CustomerName
RowSource = DataEnviroment1
RowMember = Command1
and the Code that Edneeis Provided me with I changed it to --->>>
Private Sub DataCombo1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
DataEnvironment1.rsCommand1.Bookmark = DataCombo1.SelectedItem
End Sub
--->>>This works very well<<<---
Now that I am fat and happy. I now need to find out how to get the list to sort in alpabetical order ` it never ends but, it's fun.....
Thankyou Edneeis for helping making this progress..
-
Feb 28th, 2001, 12:30 PM
#5
Here is the scoop (depending on what you are doing), if you set the datacombo data source,member, and field props then sometimes when you select a new record via the combo it just inserts the value into the field assigned in the datafield prop. So just a warning if you run into any problems if not then nevermind.
-
Feb 28th, 2001, 05:59 PM
#6
Thread Starter
Hyperactive Member
After my last post I started to see the problem you just described. I had to drop the settings Data Sorce, Member, and Field .
Do you know how I can have the list in the bound column to sort in alpabetical order ?
Thanks again for your help..
Jason
-
Mar 6th, 2001, 11:23 AM
#7
Unfortunatly you can't sort or filter the records in the combo unless you change the actual recordset its bound to and rebind it. So you could set up you data environment command to sort and then bind it.
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
|