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

If my listboxes contain no entries, then my command button should stay disabled

P: 58
If both of my listboxes are not selected, my command button needs to stay disabled. Whats the code for this? I tried everything, im pulling my hair out lol
May 14 '07 #1
Share this Question
Share on Google+
6 Replies


P: 58
If both of my listboxes are not selected, my command button needs to stay disabled. Whats the code for this? I tried everything, im pulling my hair out lol
anyone? :(
May 14 '07 #2

P: 58
anyone? :(
let me rephrase the topic. if my listboxes are not selected then my command button should stay on disabled. when both selections are made (1 from each listbox) then the command button can be enabled. anyone know how to come across this?
May 14 '07 #3

ADezii
Expert 5K+
P: 8,638
let me rephrase the topic. if my listboxes are not selected then my command button should stay on disabled. when both selections are made (1 from each listbox) then the command button can be enabled. anyone know how to come across this?
Expand|Select|Wrap|Line Numbers
  1. If IsNull(Me![lstOne]) And IsNull(Me![lstTwo]) Then
  2.   Me![cmdTestButton].Enabled = False
  3. Else
  4.   Me![cmdTestButton].Enabled = True
  5. End If
May 17 '07 #4

P: 58
Expand|Select|Wrap|Line Numbers
  1. If IsNull(Me![lstOne]) And IsNull(Me![lstTwo]) Then
  2.   Me![cmdTestButton].Enabled = False
  3. Else
  4.   Me![cmdTestButton].Enabled = True
  5. End If
this doesnt work. where should i put this? form load??
May 18 '07 #5

ADezii
Expert 5K+
P: 8,638
this doesnt work. where should i put this? form load??
  1. If you are doing this for each Record, place the code in the Form's Current() Event.
  2. Substitute your Control Names for lstOne, lstTwo, and cmdTestButton.
May 18 '07 #6

missinglinq
Expert 2.5K+
P: 3,532
when both selections are made (1 from each listbox) then the command button can be enabled
This sounds like the OP wants the button enabled only if a selection has been made from each listbox, which is to say if either Or both listboxes are unselected the button should not be enabled

Expand|Select|Wrap|Line Numbers
  1. If IsNull(Me![lstOne]) Or  IsNull(Me![lstTwo]) Then
  2.   Me![cmdTestButton].Enabled = False
  3. Else
  4.   Me![cmdTestButton].Enabled = True
  5. End If
Jun 13 '07 #7

Post your reply

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