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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

combo object change event question 1

Status
Not open for further replies.

new2unix

Programmer
Feb 5, 2001
143
US
Hi,

I am unable to trigger a SAVE button to be enabled upon a change in the combo box selection. The combo box is populated by the following database query:

Private Sub LoadModelUnit()

Dim mrsModelUnit As Recordset
Dim sSQL As String

Set mrsModelUnit = New Recordset

sSQL = sSQL & "SELECT * FROM ModelUnit"

With mrsModelUnit
.CursorType = adOpenStatic
.CursorLocation = adUseClient
.ActiveConnection = cnTestConnection
.LockType = adLockOptimistic
.Source = sSQL
.Open

Do Until .EOF
cboModelUnit.AddItem !ModelUnit
.MoveNext
Loop
End With

mrsModelUnit.Close
Set mrsModelUnit = Nothing

End Sub

When the user select a different item from the combo list, the SAVE button should be enabled by a call to a RecordChanged function, which just have a line for "cmdSave.enable = true," from the combo change event:

Private Sub cboModelUnit_Change()

RecordChanged

End Sub

But the SAVE button was not enabled as expected. What type of coding should I put in to correct it?

Thanks,

Mike
 
I've never been successful using the change event for the combo box. Use the click event and save off the original value somewhere - then compare it to the current combo value - and if it changed - enable the save command.

"I think we're all Bozos on this bus!" - Firesign Theatre [jester]
 
Thanks! The click event is working as suggested.

Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top