Results 1 to 3 of 3
  1. #1
    Lounger
    Join Date
    Feb 2001
    Location
    Orlando, FL
    Posts
    44
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Limit to list - Add new record

    I have a form that adds new classes, dates and times that contains a subform that adds the students to the classes. A field (ClassName) in the main form is a combo box that refers to a field in another table (CourseName)that holds the course name. I do this because I may have several classes that cover the same course material but are on different dates. My problem is that if the course name has not been entered into the CourseName table, I can't add it. The CourseName table only has two fields, an ID field and the CourseName field. Since I have bound the combo box to the ID field and set it to a length of 0" so it won't appear, I can't set the Limit to List property to No. How do I accomplsh this w/o having to go into the CourseName table and add it.

    Thank you

  2. #2
    3 Star Lounger
    Join Date
    Feb 2001
    Location
    NYC,USA,Earth
    Posts
    273
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Limit to list - Add new record

    This is usually done by setting the notinlist property of the combobox to a macro or event procedure. In the procedure the user is prompted if they want to add the value to the list. Based upon the user's response the item is added to the list or the user is prompted to select an entry from the list. To see an example of such a procedure check the notinlist event in the online help. Post back if you still have questions.

  3. #3
    Lounger
    Join Date
    Apr 2001
    Location
    Stuttgart, Germany
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Limit to list - Add new record

    Larry,

    You can add the new course name in the combo's NotInList event procedure. When Limit to List property is set to Yes, it fires each time the user enters a new item. Basically, you then open a recordset based on the CourseName table and add a new record with the new name.

    Setting the Limit to List property to No would not help you, because the new name would only appear in the combo. There would be no new record in the CourseName table automatically added. Anyway, you could not set the property to No because of the ID. I suppose there is a relation between CourseName ID and ClassName ID.

    For Access 95/97 there is a KB article:
    INF: Use NotInList Event to Add a Record to Combo Box (7.0/97)
    Article ID: Q161007

    There must be something similar for Access 2000, or you can take the same code.

    And maybe you'll consider to provide some way to update/add the course names through a simple endless form - there are always typing errors.

Posting Permissions

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