Page 2 of 2 FirstFirst 12
Results 16 to 23 of 23

remove selected item from listbox with Row Source: QueryName

  1. #16
    mdavid is online now Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Oct 2017
    Posts
    47
    Thanks Orange, I'll use this for the English Names.


    Another thing I'd appreciate help with is how to use the same above code for all the Common Name languages, just passing a parameter for each language (English, Hebrew, Arabic or Other) listbox query.

    Thanks for any help
    David

  2. #17
    Micron is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    2,933
    I'm totally lost/confused now. I see many calculated controls (e.g. Species ID) and wonder why they just aren't bound.
    And many unbound controls that you want to copy data from, to the right side, which makes me wonder why the source controls are also unbound.
    And wonder why you'd bother to copy something to the right, only to want to delete it - unless you're thinking you can remove something from one column only, which can be done but is probably unnecessarily difficult given that there has to be a better way to achieve the desired outcome. In a multi column listbox or combo, Access divides the values amongst the columns. If you want to remove one item from one column, you have to end up with ;; between the last value from col 1 and the next value for col 1.

    Maybe post a copy of your db and we'll see if there are any other recommendations. But I fear that it will be all to confusing to decipher what is versus what should be going on. Alternatively, maybe you should just abandon this approach and try a main form with 3 subforms; top 2 for source data that can't be edited, bottom for editing, and load the bottom form with data from the other two via command buttons if you need to be selective. I still cannot see why listboxes are being used.

  3. #18
    mdavid is online now Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Oct 2017
    Posts
    47
    Hi Micron, sorry i haven't succeeded in explaining the purpose of the form clearly. I have a good idea of what i want to do, I will show it to the user next week, and see if they're happy with this form.
    The next stage is to document all the medical complaints treated by these plants and I will consider using your suggestion of the 3 subforms there.
    Please could you explain or give me a link to an explanation of bound and unbound controls.
    Here is an example of the form in use:

    Click image for larger version. 

Name:	SpeciesFrm2.jpg 
Views:	11 
Size:	109.6 KB 
ID:	30790

  4. #19
    Micron is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    2,933
    A bound control is "linked" to a table or query field so that if the underlying data is altered the control can reflect the changes, or it can be used to modify the values in the field that it's bound to (assuming the record is updatable. An unbound control is not linked to any field. If it is used to add data to a table it must be done indirectly. Unbound controls are often used to display calculated or concatenated values amongst other uses.
    Last edited by Micron; 10-12-2017 at 05:07 PM. Reason: dang phone auto correct
    - "doesn't work" is no help.Error #s/text do. State what's happening.
    - Use code tags for code/sql; show where errors occur
    Make all suggested changes in copies of your database or to its objects

  5. #20
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    11,591
    David,

    Not sure of anything global re multi-languages. A lot probably depends on specifics of your application.


    An interesting, free video tutorial by DataPig re listboxes generally that may be of some value to you.
    It's not too long and well worth watching.

  6. #21
    mdavid is online now Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Oct 2017
    Posts
    47
    Sorry not making myself clear again, I meant using the same vba code for several command buttons, just passing a parameter to the code to indicate which command button was pressed


    Thanks
    David

  7. #22
    Micron is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    2,933
    Pass to what - the form opening? If so, you could pass whatever you like if you use the OpenArgs parameter of the DoCmd.OpenForm method. When the form not opens, you can check that parameter value, such as
    Code:
    Select Case Me.OpenArgs
      Case "apple"
        do apple stuff
      Case "orange"
        do orange stuff
     Case Else
        do default stuff
    End Select
    However, if you want to work with form values, use the load event to check the argument since form values aren't present until the Load event. Or based on the button clicked, you can make use of the form's filter property and apply a filter. Regardless, every button has to trigger the desired action by way of its Click event. Rather than repeat a bunch of similar code for each button click, you can first call a sub that accepts parameters, such as
    Code:
    Private Sub Command6_Click()
      MyCustomSub "orange"
    End Sub
    
    Sub MyCustomSub (msg As String)
    msgbox msg
    End Sub
    The red line is the only thing you'd need to have in every click event involved, as long as you alter the quoted value to suit each button. What you pass can be the button name or caption (if it has one) if that would be better (Me.Command6.Name or Me.Command6.Caption).
    Last edited by Micron; 10-13-2017 at 10:22 AM. Reason: code correction

  8. #23
    mdavid is online now Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Oct 2017
    Posts
    47
    Hi Micron, Thanks for your clear explanation, I'll give it a try

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-26-2016, 01:53 AM
  2. Replies: 7
    Last Post: 11-29-2015, 06:24 AM
  3. Show Checkbox when listbox item is selected
    By gammaman in forum Modules
    Replies: 5
    Last Post: 06-04-2015, 08:46 AM
  4. Replies: 13
    Last Post: 07-29-2013, 06:55 AM
  5. Replies: 7
    Last Post: 06-05-2012, 02:22 PM

Tags for this Thread

Posting Permissions

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