Results 1 to 5 of 5
  1. #1
    websterh is offline Novice
    Windows XP Access 2007
    Join Date
    Oct 2010
    Posts
    8

    Exclamation Issues with Default combo box value based on table yes/no field

    Hi all,
    I've searched and searched and tried variations for several hours with no luck. I have experience in creating register, activity and clinical databases.



    My database is an activity collection tool/database, each activity would have a question identified to it. And will eventually be split.

    My issue is the "Default value" for a Form field- named 'Question' - sourced data from table 'LU Question' i have the fields Question/Visible/Default/MonthUsed; with the Visible and Default being Yes/No.
    ( Visible :: Yes = shows only those questions ticked on the form/combo box -- so this works fine )
    ( The Default :: Yes = does not display, I'm having issues with the correct code assignment - done so through the Form Design, Combo box properties, Default value option/selection )

    I would like the question, that's selected as Default in the LU table, to show up automatically in the Combo box on the Form.

    Names of the form/fields are:

    • Form: HarmMinEF
    • Question/Combo box: Question
    • Lookup table / field / value name: LU Question / Default / Yes

    I have attempted variations with the way to retrieve the default and select it, but none worked (even tried doing a query to pick the Yes=Default from the LU but doesn't display - always comes up with #Name? (this appears for my other attempts too)).

    Any help withthe code or source would be appreciated.
    Last edited by websterh; 12-20-2011 at 10:10 PM.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Want to provide project for analysis?
    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
    dblife's Avatar
    dblife is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Nov 2011
    Location
    South Shields, UK
    Posts
    104
    please see attached db showing how this can be done.
    you can use the formload event to make it happen.
    when the form loads, the vb code uses the 'dlookup()' function to call up the value of the record where default is 'true'
    this numeric value goes into the combo as default, but because the key value has it's width set to '0', the queston appears in the combo.
    hope this helps.

  4. #4
    websterh is offline Novice
    Windows XP Access 2007
    Join Date
    Oct 2010
    Posts
    8

    Thumbs up

    Thanks for the post and example, dblife, although it did work on the load it doesn't on the update as it counts a new record when 'add new record' even when not selected any fields like you'd normally would.

    To cut myself free 'fancy' d lookup of this i've decided to copy/paste the 'Question' to the default property on the combo box.

    I'd have to update the Default yes/no anyway so ...... yeah/that's it.
    Thank you.

  5. #5
    dblife's Avatar
    dblife is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Nov 2011
    Location
    South Shields, UK
    Posts
    104
    very welcome..

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

Similar Threads

  1. Combo box based on table plus 'All'?
    By kman42 in forum Forms
    Replies: 1
    Last Post: 09-22-2011, 03:51 PM
  2. Replies: 1
    Last Post: 08-31-2011, 04:03 PM
  3. Replies: 5
    Last Post: 01-20-2011, 11:36 PM
  4. Default Value in table = Field plus 3 days
    By AmyLynnHill in forum Access
    Replies: 1
    Last Post: 08-03-2008, 01:58 AM
  5. Replies: 1
    Last Post: 12-09-2005, 09:27 PM

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