Results 1 to 4 of 4
  1. #1
    Juan4412 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Dec 2010
    Posts
    209

    Set TextBox To Take Array Value

    I have a text box on my form, that you enter an employee name into then press a button and the button displays a messagebox showing if the employee is Active or In-Active. I want to set it so that I can enter multiple employee names instead of having to do each employee individually. W/O showing the query that runs to pull the status, this is what the Click() Event for my button does
    Code:
    MsgBox tb123 & strStatus, vbInformation
    What do I need to alter so that more than one result can be performed and displayed?

  2. #2
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,849
    How do you want to automate it?

    If you had employee name and status in a table, you could place the info onto a form in a text box.
    You could create a series of msgboxes, but how do you expect these to be seen/used?

  3. #3
    Juan4412 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Dec 2010
    Posts
    209
    I was wanting to be able to input an array into the TextBox, then was going to either 1) format the message box so only one employee name was displayed per line OR add in a much larger textbox lower on the form and have the results displayed there.

  4. #4
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    you have to have a consistent way of entering the names and a universal separator (space or comma likely won't work)

    so let's say you choose the semi colon ;

    if you want them to enter their search names

    Smith; Jones; Mayberry

    You can use the SPLIT function to break this into an array

    Code:
    dim nameArray as array
    
    namearray = split(searchstring, ";")
    
    for i = 1 to ubound(namearray)
        debug.print namearray(i)
    next i
    then you'd have to jam your search mechanics into the array looping

    EDIT: I think arrays are zero indexed like list boxes and combo boxes so you may have to use for i = 0 to ubound(namearray) and when dealing with an array of strings you might have to use dim namearray() as string

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Array without trailing 0
    By Ruegen in forum Programming
    Replies: 2
    Last Post: 10-30-2014, 11:06 PM
  2. Need help with array
    By programmingbeginner in forum Programming
    Replies: 14
    Last Post: 08-28-2014, 01:30 PM
  3. Figuring out an array
    By crowegreg in forum Programming
    Replies: 6
    Last Post: 08-08-2013, 04:56 PM
  4. Replies: 2
    Last Post: 04-20-2013, 03:37 AM
  5. Replies: 8
    Last Post: 04-12-2013, 08:59 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