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

Close Comand Button updating unwanted records 2

Status
Not open for further replies.

RedHatter

Technical User
Dec 5, 2001
7
IE
HI There,
I have the following probelm.

I have created a FORM which contains an update command button using the criteria from the selection of two combo boxes on the form.

The problem is ;
If a user selects something from the two combo boxes but then presses the Close form button . The data in the combo box is transferred automatically to the table. This creates false data

I only want the data updated when the update query command button is pressed.

many thnkas inadvance fro help
 
Create any marker on your form or in the form code and verify it during closing form.

Example
Option Compare Database
Option Explicit

dim blnIsQueryUpdated as boolean

private sub queryCommandButton_Click()
blnIsQueryUpdated =true
'Also you can update any unvisible textbox on your form...
.....do your code
.......
end sub

private sub Form_Unload()
if blnIsQueryUpdated = false then
me.undo
end if
docmd.close
end sub

Also you can update any unvisible textbox on your form...

Aivars
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top