List Box

  • Thread starter Thread starter Dickbee
  • Start date Start date
D

Dickbee

I want to ensure that when people exit a form that in certain list boxes
information must be entered is there are simple way to do this.

Thanks
 
I want to ensure that when people exit a form that in certain list boxes
information must be entered is there are simple way to do this.

Thanks

Code the Form's Unload event:

If IsNull([ControlName]) Then
MsgBox "You must enter data."
Cancel = true
Me![ControlName].SetFocus
End if
 
Could be a listbox where null is not an option.
Anyone got change for a nickel? Cause that's just my two cents.
 
I have no idea about code do I just copy in what you have put there or is
there more to it. Or am I wasting my time because I don't know how to use
code. Are the books you can get that will help me right code.

Thanks

fredg said:
I want to ensure that when people exit a form that in certain list boxes
information must be entered is there are simple way to do this.

Thanks

Code the Form's Unload event:

If IsNull([ControlName]) Then
MsgBox "You must enter data."
Cancel = true
Me![ControlName].SetFocus
End if
 
Can i appoligise and say that it is a combo box not a list box does this
change everything. Sorry Still learning this stuff
 
I have no idea about code do I just copy in what you have put there or is
there more to it. Or am I wasting my time because I don't know how to use
code. Are the books you can get that will help me right code.

Thanks

fredg said:
I want to ensure that when people exit a form that in certain list boxes
information must be entered is there are simple way to do this.

Thanks

Code the Form's Unload event:

If IsNull([ControlName]) Then
MsgBox "You must enter data."
Cancel = true
Me![ControlName].SetFocus
End if

Display the Form's property sheet.
Click on the Event tab.
Click on the event line you wish to code (the Unload event line).
Write
[Event Procedure]
on that line.
Then click on the little button with the 3 dots that appears on that
line.
When the code window opens, the cursor will be flashing between 2
already existing lines of code.
Between those lines write this code.

If IsNull([ControlName]) Then
MsgBox "You must enter data."
Cancel = true
Me![ControlName].SetFocus
End if

You can either copy and paste the above code, or just write it.
Change [ControlName] to whatever the actual name of the control is you
wish to check for Null.
And no, it doesn't matter if it is a List Box or a Combo box.
 
Back
Top