Results 1 to 3 of 3
  1. #1
    4 Star Lounger
    Join Date
    Aug 2001
    Location
    Anaheim, California, USA
    Posts
    560
    Thanks
    17
    Thanked 2 Times in 2 Posts
    I have a database that I use to keep track of attendees for various functions. Most of the people come from our general geographic area, which is about 10 different cities. There are times that I get a sign up from someone that is outside of our area.

    Currently, I just have a text box in the attendees table, where I enter the city name. How can I set it up so that I can use a drop down list, but it will still allow me to enter a city that isn't in the list? The answer is probably out there, but I just couldn't seem to come up with the correct search terms. Thanks for your help.

  2. #2
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts
    [quote name='donebb' post='767707' date='26-Mar-2009 21:31']I have a database that I use to keep track of attendees for various functions. Most of the people come from our general geographic area, which is about 10 different cities. There are times that I get a sign up from someone that is outside of our area.

    Currently, I just have a text box in the attendees table, where I enter the city name. How can I set it up so that I can use a drop down list, but it will still allow me to enter a city that isn't in the list? The answer is probably out there, but I just couldn't seem to come up with the correct search terms. Thanks for your help.[/quote]
    The easiest way is to make it a combobox, with a rowsource something like this:

    SELECT DISTINCT City FROM tblAttendees ORDER BY City

    If you type a city already in list, it will fill-in for you as you type. If you type a city not in the list, then just put some code in the control's BeforeUPdate event, something like this:

    If cboCity.ListIndex = -1 then
    if vbNo=Msgbox("Accept it anyway?",vbquestion+vbyesno,"Not in list!") then
    cancel=true
    exit sub
    end if
    end if

    Oh yes, put a cboCity.Requery in the control's OnEnter event.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  3. #3
    4 Star Lounger
    Join Date
    Aug 2001
    Location
    Anaheim, California, USA
    Posts
    560
    Thanks
    17
    Thanked 2 Times in 2 Posts
    That works great. Thanks Mark.

Posting Permissions

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