Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Jul 2006
    Location
    Wichita, Kansas, USA
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    List box help, or a better suggestion (2003/SP1)

    I'm using a list box to allow a user to quickly select multiple items from a list of options. Right now, it is set up that when you click a button it updates a table with records relating to whatever choices you make (kinda like using a form/subform). This is my code for the button OnClick:

    Dim frm As Form, ctl As Control
    Dim varItm As Variant
    Set frm = Forms![TEST]
    Set ctl = frm![acctType]
    For Each varItm In ctl.ItemsSelected
    DoCmd.GoToRecord , , acNewRec
    AccountTypeID = ctl.ItemData(varItm)
    ReferralLogDate = Date
    Next varItm
    ctl.SetFocus
    Command2.Enabled = False

    At which point the button is disabled, so they cannot change their selection. How can I allow changes to be made on the fly (or just by clicking the button again) keeping the table updated accordingly? This form will eventually be a subform in another form. This is a referral table that is linked back to the main log table. Not that that information is necessary.

    To be honest I deem a list box to be much quicker than using a form/subform setup, as the user will be already entering data on 2 other tabs on the main form.

    I want this form to be able to update the table by adding or deleting or ignoring selections that are new, removed, or unchanged. By clicking the button (the one above, that already adds the records).

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: List box help, or a better suggestion (2003/SP1)

    I understand your reasons for wanting to use a list box, but I'd still use a subform, since it manages almost everything without needing any code. If you want to use a multi-select list box, you must write lots of code.

  3. #3
    New Lounger
    Join Date
    Jul 2006
    Location
    Wichita, Kansas, USA
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: List box help, or a better suggestion (2003/SP1)

    I believe I will keep it simple then, and toy around with it after the DB is implimented. Thank you for your suggestion.

    Aaron

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •