On a form I have a combobox that displays either YES or NO.
I also have a SAVE command button that saves any changes to a database, If the PAGE CLOSE command button is clicked, I need to detect if the YES NO text has changed and if it has been changed and the SAVE button has not been clicked, I need to display a message prompting the user to save.
I dont know how to detect if the combobox has changed when the user clicks the CLOSE button.
I believe I understand the problem, but here's another scenario....
User has Combo = YES, and then clicks the save button, and then does more database changes. In what you are describing, you wouldn't catch this when Page Close occurs, or are there other checks you haven't described?
Assuming the above scenario can't happen, then an easy answer might be as follows. Another assumption: combo1 style is 2 (dropdown list)
1. At top of from add: Dim bDirty as Boolean
2. In your Save button click event: bDirty=False
3. In your combobox click event:
If Combo1.Text = "YES" Then bDirty=True Else bDirty=False
4. In your PageClose event:
If bDirty = True Then ' prompt for saving
Now if you have any other code that checks whether something changed that should be saved, then in that event/routine:
If Combo1.Text = "YES" Then bDirty=True
Tip: In any text boxes that contain field data, in the Change event, you can set bDirty=True to indicate something changed; your decision.