Results 1 to 12 of 12
  1. #1
    Star Lounger
    Join Date
    Oct 2001
    Posts
    98
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Combo box (Access 2003 sp1)

    I have a combo box that lists class titles and dates. I want the user to select a class title and then have the date automatically be filled in another field. How do I do that?

  2. #2
    5 Star Lounger
    Join Date
    Nov 2004
    Location
    Wilmington, North Carolina, USA
    Posts
    1,196
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Combo box (Access 2003 sp1)

    When you create your combo box, the wizard should give you the option to set the focus of your form when the user makes a selection from your combo box. Then all you have to do is create a text box that displays the date <img src=/S/smile.gif border=0 alt=smile width=15 height=15>
    ____________________________
    Jeremy
    "If you spend more on coffee than on IT security, then you will be hacked. What&#39;s more, you deserve to be hacked." -Richard Clarke

  3. #3
    Star Lounger
    Join Date
    Oct 2001
    Posts
    98
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Combo box (Access 2003 sp1)

    I don't know what you mean by 'set the focus'. It asks what fields to display and whether to remember the value for later use, or store in this field. So I want the title that they choose to be displayed in the combobox field and then have another field for the startdate. I want the date to be entered automatically when they choose the title.

  4. #4
    5 Star Lounger
    Join Date
    Nov 2004
    Location
    Wilmington, North Carolina, USA
    Posts
    1,196
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Combo box (Access 2003 sp1)

    By 'set the focus' I mean choose the record for which you mean to be looking at (which class). Is your form simply for information, or are you also trying to add data? Could you provide a little more information - field names, etc? If you've got a table tblClasses with the fields "CLASS" and "DATE", and your form (frmClasses) has a combo box cboCLASS, you could set a text box's control source to ="[date]", "tblClasses", "[class] =" & forms![frmClasses]![cboClass])
    ____________________________
    Jeremy
    "If you spend more on coffee than on IT security, then you will be hacked. What&#39;s more, you deserve to be hacked." -Richard Clarke

  5. #5
    Star Lounger
    Join Date
    Oct 2001
    Posts
    98
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Combo box (Access 2003 sp1)

    On the form there is a combobox which the user will select a particular title. I would like for the startdate field to be filled in on the form when the title is checked. Then the user will type in the date of the reservation, the need for subs, etc.

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

    Re: Combo box (Access 2003 sp1)

    Depending on how your tables are structured, you have several options:

    1) Create a query based on the table behind your form and on the table containing the class titles/dates, joined on class title with an outer join (return all records from the table behind the form). Add all fields from the table behind the form to the query grid, plus the date field from the other table. Use the query as record source of your form instead of the table. When the user selects a class title from the combo box, the date field will be filled in automatically.

    2) Use a calculated text box for the date, with control source

    =[cboClassTitle].[Column](1)

    where cboClassTitle is the name of the combo box. Columns are numbered starting at 0, so Column(1) is actually the 2nd column. The user cannot edit the date.

    3) Use code in the After Update event of the combo box:

    Private Sub cboClassTitle_AfterUpdate()
    Me.txtDate = Me.cboClassTitle.Column(1)
    End Sub

    where cboClassTitle is the name of the combo box and txtDate is the name of the date text field. The user can edit the date after it has been filled in automatically.

  7. #7
    5 Star Lounger
    Join Date
    Nov 2004
    Location
    Wilmington, North Carolina, USA
    Posts
    1,196
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Combo box (Access 2003 sp1)

    What kind of database is this, for a teacher, for students? Whom will be filling in the information? What is the purpose of the database? Is it to create a class roster? To let a teacher make known their requirements?

    Could you post a stripped down example of your database? See <post#=401,925>post 401,925</post: > for instructions.
    ____________________________
    Jeremy
    "If you spend more on coffee than on IT security, then you will be hacked. What&#39;s more, you deserve to be hacked." -Richard Clarke

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

    Re: Combo box (Access 2003 sp1)

    Sounds familiar, somehow. What does it remind me of? <img src=/S/evilgrin.gif border=0 alt=evilgrin width=15 height=15>

  9. #9
    5 Star Lounger
    Join Date
    Nov 2004
    Location
    Wilmington, North Carolina, USA
    Posts
    1,196
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Combo box (Access 2003 sp1)

    I dunno.. <img src=/S/liar.gif border=0 alt=liar width=25 height=22>
    <img src=/S/innocent.gif border=0 alt=innocent width=20 height=20>

    You know what they say about impersonation....
    ____________________________
    Jeremy
    "If you spend more on coffee than on IT security, then you will be hacked. What&#39;s more, you deserve to be hacked." -Richard Clarke

  10. #10
    Star Lounger
    Join Date
    Oct 2001
    Posts
    98
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Combo box (Access 2003 sp1)

    It is for the HR dept to register students for classes and also print confirmation letters, class rosters, etc. I have attached a part of the database as suggested.

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

    Re: Combo box (Access 2003 sp1)

    Set the control source of Text14 to =Combo12.Column(1)

  12. #12
    Star Lounger
    Join Date
    Oct 2001
    Posts
    98
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Combo box (Access 2003 sp1)

    Wow -- that is so easy if you know. Thanks so much.

    Jane

Posting Permissions

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