I have a form where the user enters their data and clicks on the save button. This runs some code that uses the INSERT INTO command to store the information as a record in a table. I then pop up a message box (default type) to let the user know that the record was inserted correctly.
This all works fine as long as the user clicks the ok button on the message box. If they click the "X" to close the box, it inserts the data but also inserts a blank record before it. The section of code that performs this operation is:
Code:
Sql = "INSERT INTO Cooperative (PDate,EDate,COProgramID,Comment,DistrictID,BlockID,VillageID,ColonyID,TargetNo,ActualNo,Female,Male,Family,HowOftenID) VALUES (#" & PDate & "#,#" & EDate & "#," & CoProgram & ",""" & Comment & """," & District & "," & Block & "," & Village & "," & Colony & "," & Target & "," & Actual & "," & Female & "," & Male & "," & Family & "," & HowOften & ")"
CurrentDb.Execute (Sql)
MsgBox("Record Added Successfully!")
It doesn't seem as though I can disable the "X" on the message box and was wondering if there is another way to fix the problem.
Thanks