I keep getting an error when I attempt to close a form from within the LostFocus event of one of it's controls. I am beginning to think it cannot be done and would appreciate a confirmation of this.
I can close the form from a command button on it but not within a control. I sure would like to however.
The context is a form to enter data record for a problem database. One of the fields to complete is named lognumber and must be a unique number (it is indexed). I perform a dLookup on the table to determine if the lognumber already exists. If it does I send a message to the user stating that they are attempting to enter a duplicate number and give them a CANCEL or OK choice.
The CANCEL sends them back to the control to rekey if that is the problem.
The OK button opens code where I change the lognumber, write the record, delete the record, then I want to close the form. It seems that no matter how I code it, if a CLOSE is within the event procedure I get the error.
I have tried a function in a module but still get the error, I guess because the procedure in the control event still has not completed. I have tried to goto a control OnClick event to close the form but still no luck.
Any advice as to how to deal with this will be appreciated.
Regards,
Sorrells
I can close the form from a command button on it but not within a control. I sure would like to however.
The context is a form to enter data record for a problem database. One of the fields to complete is named lognumber and must be a unique number (it is indexed). I perform a dLookup on the table to determine if the lognumber already exists. If it does I send a message to the user stating that they are attempting to enter a duplicate number and give them a CANCEL or OK choice.
The CANCEL sends them back to the control to rekey if that is the problem.
The OK button opens code where I change the lognumber, write the record, delete the record, then I want to close the form. It seems that no matter how I code it, if a CLOSE is within the event procedure I get the error.
I have tried a function in a module but still get the error, I guess because the procedure in the control event still has not completed. I have tried to goto a control OnClick event to close the form but still no luck.
Any advice as to how to deal with this will be appreciated.
Regards,
Sorrells