Stop Form from closing!

  • Thread starter Thread starter Bob
  • Start date Start date
B

Bob

Can I stop a form from closing unless there is some data in a combo box on
the form, cbOwnerID
Thanks for any help.Bob







..........Jenny Vance
 
Can I stop a form from closing unless there is some data in a combo box on
the form, cbOwnerID
Thanks for any help.Bob

.........Jenny Vance

You can code the Form's Unload event:
If IsNull(Me![cbOwnerID]) Then
MsgBox "The cbOwnerID control is blank."
Cancel = true
End If
 
Oops its not going to work because its on a SubForm/SubReport on that
form...Thanks Bob

fredg said:
Can I stop a form from closing unless there is some data in a combo box
on
the form, cbOwnerID
Thanks for any help.Bob

.........Jenny Vance

You can code the Form's Unload event:
If IsNull(Me![cbOwnerID]) Then
MsgBox "The cbOwnerID control is blank."
Cancel = true
End If
 
Just change this line:
If IsNull(Me![cbOwnerID]) Then
To
If IsNull(Me!MySubFormControl.Form![cbOwnerID]) Then

MySubFormControl name should be the name of the subform control on your
form, not the name of the form that is the source object for the subform
control.

Bob said:
Oops its not going to work because its on a SubForm/SubReport on that
form...Thanks Bob

fredg said:
Can I stop a form from closing unless there is some data in a combo box
on
the form, cbOwnerID
Thanks for any help.Bob

.........Jenny Vance

You can code the Form's Unload event:
If IsNull(Me![cbOwnerID]) Then
MsgBox "The cbOwnerID control is blank."
Cancel = true
End If
 
Back
Top