Full Version: Cancel action if no selection is made in list box
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
MrSiezen
I've got a simple command which closes a form and opens another with information based on a selection made in a list box. Somehow I want to make sure they have made a selection before the form is closed.

I thought this was correct, but it seems not to be:

If Me.NetwerkenListBox <> Null Then
DoCmd.Close
End If

What's wrong?
dashiellx2000
Try this:

QUOTE
If Me.NetwerkenListBox = "" or IsNull(Me.NetwerkenListBox) Then
Msgbox "You must make a selection from NetwerkenListBox", vbExclamation, "Error"
Me.NetwerkenListBox.SetFocus
Else
DoCmd.Close
End If
MrSiezen
Works like a charm!

Thx!
dashiellx2000
Glad I could help.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.