how to update database using freeform list

Carl S 5 Reputation points
2023-11-22T16:45:14.7733333+00:00

I want to update a table based off of a list box. The list box needs to be freeform, copy/paste list.

I have a table for servers. 1 column is for server names and another is for decommissioned (yes/no checkbox). I want to be able to provide a list of servers that the query/event/macro will go and update the record to check off that box for servers in the list.

I tried doing this with a list box (allow value list edits = yes), and have a button with an event. In the event, I said 'for each item in me.lstServerNames' but it doesn't like this. It says it doesn't support this property or method. How do I get around this?

Access
Access
A family of Microsoft relational database management systems designed for ease of use.
309 questions
Access Development
Access Development
Access: A family of Microsoft relational database management systems designed for ease of use.Development: The process of researching, productizing, and refining new or existing technologies.
825 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Karl Donaubauer 1,646 Reputation points MVP
    2023-12-04T14:14:16.69+00:00

    Hi,

    If you are searching for a method to iterate through the items/rows in the listbox, you can try this:

    Dim i As Long
    
    For i = 0 To Me!lstServerNames.ListCount - 1
        Debug.Print Me!lstServerNames.Column(0, i)
        i = i + 1
    Next i
    
    

    This should show you the items in the immediate window.

    Servus
    Karl


    Access Forever
    Access News
    Access DevCon
    Access-Entwickler-Konferenz AEK

    I don't know your Execute statement