Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Datarepeater and combobox

Status
Not open for further replies.

Ekliptic

Programmer
Dec 12, 2000
23
0
0
CA
This problem has been wearing on me for sometime now and I've tried everything that I can think of to fix it. Anyway, I have created a custom control to be placed in a data repeater of another project. In this custom control there are 3 text boxes and one combobox. I don't want to allow the user to update the three text boxes, which is working for me, but I want to allow the user to update the combobox. The combobox loads fine with the correct data but when the user clicks on a different value it doesn't update the database. I've checked over my gets and lets and I also think that I've got my property changes correct. Here is the code....

Private Sub cboWeight_Change()
PropertyChanged "Weight"
End Sub

Private Sub cboWeight_Click()
PropertyChanged "Weight"
End Sub

Private Sub lblCharter_Change()
PropertyChanged "Charter"
End Sub

Private Sub lblGID_Change()
PropertyChanged "GID"
End Sub

Private Sub lblTeam_Change()
PropertyChanged "Team"
End Sub

Public Property Get Charter() As Variant
Charter = lblCharter.Caption
End Property
Public Property Let Charter(ByVal NewCharter As Variant)
lblCharter.Caption = NewCharter
End Property

Public Property Get GID() As Variant
GID = lblGID.Caption
End Property
Public Property Let GID(ByVal NewGID As Variant)
lblGID.Caption = NewGID
End Property

Public Property Get Team() As Variant
Team = lblTeam.Caption
End Property

Public Property Let Team(ByVal NewTeam As Variant)
lblTeam.Caption = NewTeam
End Property

Public Property Get Weight() As Variant
Weight = cboWeight.Text
End Property

Public Property Let Weight(ByVal NewWeight As Variant)
cboWeight.Text = NewWeight
End Property

I would appreciate any help I can get!

Thanks
 
By looking at the code I don't see where you are attempting to update the database.

Are you refering to the following event in your code?

Private Sub cboWeight_Click()
PropertyChanged "Weight"
End Sub

Does the sub PropertyChanged contain the code for updating the database or is the combobox bound to a field in the database?
 
Hi garths2,

Thanks for your reply. I've bound the combo box in the ocx to an adodc on my form. From there I've set up the field mapping from the combobox to the Weight field in my database through the adodc. Hope this helps clarify the situation a little more.
 
Since I am not sure what your set up is please forgive me if my suggestiton is way off:

I would add the following line to where you are changing the value in the combobox, after the value has been changed of course:

Adodc1.Recordset.Update

NOTE: as you probably already know change the Adodc1 to what the name of your adodc control is.

Once again since I am not sure what your set up is I appologize if I am leading you down the wrong path.

Hope this helps.
 
Hmmm that didn't work either. I just doesn't seem to want to take for some reason. I'm going to try rebuilding the control again (for a third time) just to make sure I didn't miss anything.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top