Hi Every Body
Here is the problem I am experiencing with it.
First I explain the situation, I have a Form and a Subform in it. My SubForm Propertie’s default View is DataSheet. There are 2 Text Boxes in My SubForm that The Entries on them must be Equal. In Order to make my Users Enter the Equal entries Incase the Entries are not equal, they are not supposed to be able to Close the Original Form Nor they should be able to Add a New Record to Original Form (Some thing Like froze should Happen, “Operation Not Allowed”)
If the Entries are not Equal, I succeeded on Don’t let them to Close the Form But they still could Add a New Record, In Order to fix this I removed My Original Navigation Buttons, and I added my Own Buttons, And in the OnClick Event of my Add New Record Button I basically Added the Following Codes:
Dim strMsg As String, strTitle As String
strMsg = "Entries Are Not Equal."
strTitle = "Admission10"
intStyle = vbOKOnly
If Sd.Value - SC.Value <> 0 Then
MsgBox strMsg, intStyle, strTitle
DoCmd.CancelEvent
End If
Which are the Exact Codes as my Original form’s Unload event.
The above works only when I Use the Tab Button After Entering into my 2 Text Boxes, But if after entering some value in the Second Text Box I do not use the Tab Button, I still can Add a New Record even if my Entries are not Equal, And Finally Close the Form.
Any suggestions?
Best Regards
Sanan
Here is the problem I am experiencing with it.
First I explain the situation, I have a Form and a Subform in it. My SubForm Propertie’s default View is DataSheet. There are 2 Text Boxes in My SubForm that The Entries on them must be Equal. In Order to make my Users Enter the Equal entries Incase the Entries are not equal, they are not supposed to be able to Close the Original Form Nor they should be able to Add a New Record to Original Form (Some thing Like froze should Happen, “Operation Not Allowed”)
If the Entries are not Equal, I succeeded on Don’t let them to Close the Form But they still could Add a New Record, In Order to fix this I removed My Original Navigation Buttons, and I added my Own Buttons, And in the OnClick Event of my Add New Record Button I basically Added the Following Codes:
Dim strMsg As String, strTitle As String
strMsg = "Entries Are Not Equal."
strTitle = "Admission10"
intStyle = vbOKOnly
If Sd.Value - SC.Value <> 0 Then
MsgBox strMsg, intStyle, strTitle
DoCmd.CancelEvent
End If
Which are the Exact Codes as my Original form’s Unload event.
The above works only when I Use the Tab Button After Entering into my 2 Text Boxes, But if after entering some value in the Second Text Box I do not use the Tab Button, I still can Add a New Record even if my Entries are not Equal, And Finally Close the Form.
Any suggestions?
Best Regards
Sanan