Page 2 of 2 FirstFirst 12
Results 16 to 28 of 28
  1. #16
    chalupabatman is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Aug 2016
    Posts
    114
    Quote Originally Posted by Missinglinq View Post
    With the MultiSelect Property set to None, it makes no sense for Me.lbxManager in the VBA editor to pop the error

    Compile Error:
    Invalid use of property.


    And when things simply make no sense, I always wonder about corruption!

    Although we usually think of Forms, and even entire Databases, when we speak of corruption, Controls, such as Listboxes, can and do become corrupted, and seem particularly susceptible to this during app development. The test/cure for this is short and simple...delete the Control and then re-create it.

    Linq ;0)>

    Column Count = 1
    Row Source Type = Value List
    Bound Column = 1


    I have deleted and re-created and now when it hits this line it shows 0 even when I selected an item.


    Code:
        If Me.lbxManager .ItemsSelected.Count = 0 Then

  2. #17
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,511
    Create a new list box and select "I will type in values" option and enter 3 values for the list. Then see if you can select one of those and with code OnClick, see if it moves to your text box with no issue. This is just a test to see if it can tell where issue is.

  3. #18
    chalupabatman is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Aug 2016
    Posts
    114
    Quote Originally Posted by Bulzie View Post
    Create a new list box and select "I will type in values" option and enter 3 values for the list. Then see if you can select one of those and with code OnClick, see if it moves to your text box with no issue. This is just a test to see if it can tell where issue is.
    I think I see what is causing this to be NULL. I have been just clicking the down arrow for the list box to populate the list box with the value, and when doing this
    Code:
    Debug.Print Me.lbxManager
    prints NULL
    but if I actually click the arrow and choose a value, THEN click inside the cell my OnClick() Event will produce the value selected from the list by using
    Code:
    Debug.Print Me.lbxManager
    Which leads me to my next ? --> is there a way to store the value w/o having to actually click in the list box itself?

  4. #19
    chalupabatman is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Aug 2016
    Posts
    114
    Quote Originally Posted by chalupabatman View Post
    Which leads me to my next ? --> is there a way to store the value w/o having to actually click in the list box itself?
    I am wanting to use the value from
    Code:
    Me.lbxManager
    in my
    Code:
    cmdSave_Click
    event. How can I pass that value to this event? (which is what I was doing unsuccessfully in the beginning...

  5. #20
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Quote Originally Posted by chalupabatman View Post
    I think I see what is causing this to be NULL. I have been just clicking the down arrow for the list box to populate the list box with the value,
    <snip>
    <snip>
    but if I actually click the arrow and choose a value, THEN click inside the cell <snip>
    Curious.... I have never seen a list box with a down arrow...... A combo box , Yes, but not a list box......
    A list box can have a vertical scroll bar..... but no down arrow.....
    I'm just sayin..... makes me wonder..


    BTW, "cell" is Excel terminology, not Access...

  6. #21
    chalupabatman is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Aug 2016
    Posts
    114
    Quote Originally Posted by ssanfu View Post
    Curious.... I have never seen a list box with a down arrow...... A combo box , Yes, but not a list box......
    A list box can have a vertical scroll bar..... but no down arrow.....
    I'm just sayin..... makes me wonder..


    BTW, "cell" is Excel terminology, not Access...
    These are the arrows I was referencing.

    Click image for larger version. 

Name:	unnamed.png 
Views:	9 
Size:	528 Bytes 
ID:	25473


    When I have the form in design view I click on Design in the ribbon and click list box from the toolbox that is displayed then draw it out on my form. Is that the correct tway to do such?

  7. #22
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    The OnClick event of both Comboboxes and Listboxes only executes when a selection is made! They don't fire when simply clicking on the Control, whether it be the DropDown on a Combobox or the Scrolling Arrows on a Listbox. You cannot select an item by simply scrolling up or down...you have to actually select it by clicking on it.

    Linq ;0)>

  8. #23
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664

    Aha, my bad. I have never used a list box that was one row tall, always around 8 rows tall. I have always used a list box to display multiple choices/options.
    Instead of a one row high single select list box, I would use a combo box.

    In any case, yes, you MUST click on the selected option in the list box to select an option - doesn't matter if the list box is 1 row tall, 8 rows tall or 16 rows tall. Try making the list box taller and you will see....

    (I learned something new )

  9. #24
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Quote Originally Posted by ssanfu View Post

    ...I have never used a list box that was one row tall...
    There's really not much point in doing so...is there? The whole idea is to be able to see a fairly large display of selections without using the DropDown of the Combobox...if you're not going to do that, you would, indeed, be better off using a Combobox. I usually have the cbo dropdown on gaining Focus, which will show multiple selections without chewing up a lot of real estate, when not actually being used.

    Linq ;0)>

  10. #25
    chalupabatman is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Aug 2016
    Posts
    114
    Quote Originally Posted by Missinglinq View Post
    The OnClick event of both Comboboxes and Listboxes only executes when a selection is made! They don't fire when simply clicking on the Control, whether it be the DropDown on a Combobox or the Scrolling Arrows on a Listbox. You cannot select an item by simply scrolling up or down...you have to actually select it by clicking on it.

    Linq ;0)>
    Ah, well be that the case. I think I will leave it as just a bound text box for now at least. Ideally, I want to limit what the user inputs, however I can not gauruntee that they will actually click inside of the text box and not use the arrow to select it from the list.

  11. #26
    chalupabatman is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Aug 2016
    Posts
    114
    Quote Originally Posted by ssanfu View Post

    Aha, my bad. I have never used a list box that was one row tall, always around 8 rows tall. I have always used a list box to display multiple choices/options.
    Instead of a one row high single select list box, I would use a combo box.

    In any case, yes, you MUST click on the selected option in the list box to select an option - doesn't matter if the list box is 1 row tall, 8 rows tall or 16 rows tall. Try making the list box taller and you will see....

    (I learned something new )
    Glad my absolute newbieness was able to teach you something, and not frusterate you to no end!

    All I am after is a way to only allow specific inputs into the text box. That way I am not getting garbage into the database (at least not form this angle).

  12. #27
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Why not use a combo box???

  13. #28
    chalupabatman is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Aug 2016
    Posts
    114
    Quote Originally Posted by ssanfu View Post
    Why not use a combo box???
    I have only used a combo box to lookup values (and have them populate on the form) - I did not know you could use a combo box to display a list of "okay" values for a user to select from.

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 07-27-2016, 12:07 PM
  2. Replies: 1
    Last Post: 01-23-2014, 05:21 PM
  3. Replies: 1
    Last Post: 11-23-2012, 10:26 PM
  4. Replies: 10
    Last Post: 10-10-2011, 08:08 PM
  5. Replies: 4
    Last Post: 06-16-2011, 09:30 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums