By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,712 Members | 1,319 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,712 IT Pros & Developers. It's quick & easy.

Command Button to be enabled only when both listbox items are selected

P: 58
Does anyone know how to start a form with a search button disabled, but when you choose a selection in listbox1 and listbox2 the button becomes enabled?
May 31 '07 #1
Share this Question
Share on Google+
7 Replies

Rabbit
Expert Mod 10K+
P: 12,441
Does anyone know how to start a form with a search button disabled, but when you choose a selection in listbox1 and listbox2 the button becomes enabled?
In the after update of each listbox have it check for nulls, if both are not null then enable.
May 31 '07 #2

P: 58
In the after update of each listbox have it check for nulls, if both are not null then enable.
what is the command for "not null' when referring to a listbox
Jun 1 '07 #3

P: 27
You can use NOT "" if a null value implies the same as a zero-length string. "" indicates a ZLS in a text field.
Jun 1 '07 #4

P: 58
You can use NOT "" if a null value implies the same as a zero-length string. "" indicates a ZLS in a text field.
I am sort of new to access so plz explain in beginner terms lol
Jun 1 '07 #5

Rabbit
Expert Mod 10K+
P: 12,441
A zero length string is not the same thing as a null.

IsNull(String) returns true if the string is null. Not IsNull(String) returns true if the string is not null.
Jun 1 '07 #6

P: 58
A zero length string is not the same thing as a null.

IsNull(String) returns true if the string is null. Not IsNull(String) returns true if the string is not null.
so the code would be:

If list1 and list2 Not IsNull(string) then
commandbutton.enabled=true ?
Jun 1 '07 #7

Rabbit
Expert Mod 10K+
P: 12,441
so the code would be:

If list1 and list2 Not IsNull(string) then
commandbutton.enabled=true ?
No, it would be
Expand|Select|Wrap|Line Numbers
  1. If Not IsNull(Me.list1) And Not IsNull(Me.list2) Then
Jun 1 '07 #8

Post your reply

Sign in to post your reply or Sign up for a free account.