Results 1 to 6 of 6
  1. #1
    gazaway is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2012
    Posts
    5

    Setting Variable Default for Combo Box

    I've created a form to allow our staff to enter and edit status information about our graduate students. I'm having trouble with a combo box. The first combo box on the form allows the user to select the student to be edited from tblGrads. The second combo box allows the user to select a committee chair for that student. The second combo box is populated with faculty names from another table (tblFaculty). However, if this information has already been entered for this student, an index into tblFaculty has been placed in the student database (tblGrads).

    When the student is selected from the first combo box, I'd like the second combo box to display the name of the faculty member that has already been selected for this student (if any). Thus the user can determine if a change is needed or skip the control if not. I've pulled the chair name out of the faculty table and into a variable, and I've set the value of the combo box default to this name. This far it works. But no default value is displayed in the combo box.

    What am I missing?



    Thanks!

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,942
    Use BeforeUpdate event of student combobox to set DefaultValue property of the second combobox. When move to new record the DefaultValue will apply.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    gazaway is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2012
    Posts
    5
    June7, No joy. I'm wondering if I haven't got the right format for the 2nd combo box DefaultValue. I've tried just the name, the index number <space> name, and Index number <,> name. Although these variations show up in the DefaultValue property of the combo box when i break the program, nothing appears as the default in the combo box on the form.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,942
    Don't understand. Show the exact code you are using.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    gazaway is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2012
    Posts
    5
    Sorry for the delay. I've determined that I can't do what I want. I was trying to set the default combo box value to display the value stored in the table for a given student. From what June7 said and from further research, it seems that the DefaultValue gets displayed only on the next new record. Instead, I've set up a text box to display the current value in the table, and then I display the combo box if the user wants to change it. Thanks for your input.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,942
    Oh, these are dependent (cascading) comboboxes on Continuous or Datasheet view form? The second (dependent) comboboxes has a lookup RowSource? This means the lookup alias won't display for some other records when the RowSource is filtered for the current record. The solution you arrived at is the only one for this situation. You can have the combobox sized so only the drop arrow shows and position it next to the textbox so looks like one control. Set the textbox as Locked Yes, TabStop No.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 4
    Last Post: 11-04-2012, 10:46 AM
  2. Replies: 6
    Last Post: 10-20-2012, 04:45 PM
  3. Setting default vaulue?
    By djclntn in forum Forms
    Replies: 17
    Last Post: 04-12-2012, 11:20 PM
  4. Replies: 2
    Last Post: 08-05-2011, 04:41 PM
  5. Form Field Default Setting
    By roofbid in forum Programming
    Replies: 3
    Last Post: 12-17-2010, 10:53 AM

Tags for this Thread

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