Results 1 to 9 of 9
  1. #1
    spidge32 is offline Advanced Beginner
    Windows 10 Access 2013 32bit
    Join Date
    Jul 2021
    Posts
    58

    Allow null value in combobox

    I have the following sub form with combo boxes on Wire Type - linked for Description and LeadSleeve - Linked for Diameter and Colour.

    The problem I have is sometime I have rows witch do not require these fields to have a value from the ComboBox. i.e. Null Value.



    I get the message. "The Microsoft Access Database engine cannot find a record in the table 'tblwire' with a key matching field(s) 'fldWdgWire.

    How do I get passed this error message?

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,825
    Perhaps don't enforce referential integrity in relationship.
    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
    spidge32 is offline Advanced Beginner
    Windows 10 Access 2013 32bit
    Join Date
    Jul 2021
    Posts
    58
    Hi June7, There is no referential integrity in the relationships. as per attached. The insulation comboBox does not cause the error.
    Attached Files Attached Files

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,825
    That image is not helpful. It doesn't show all tables, Snip tool popup obscures, can't see link details.

    If you want to provide db for analysis, follow instructions at bottom of my post.
    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
    spidge32 is offline Advanced Beginner
    Windows 10 Access 2013 32bit
    Join Date
    Jul 2021
    Posts
    58
    Attached is a zip file of the database. If you can help that would be great. The form is Job Sheet,
    What is required is that the ComboBoxes for Wire Code, Insulation and Lead/Sleeve do not have to have data and can remain blank.
    When the Type is I1 etc, it only requires data in the insulation and Layer fields. I now have to have "0" in the wire type or lead/sleeve for the row to post the record.
    Attached Files Attached Files

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,825
    The difference is lookup tables for Wire and Sleeves are included in RecordSource, Insulation is not. I removed those tables and no more error.

    To show lookup table info in textboxes, reference columns of combobox by index with expression in textbox. Index begins with 0 so column 2 is index 1.

    = [WireCombo].Column(1)

    Set those textboxes Locked Yes and 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.

  7. #7
    spidge32 is offline Advanced Beginner
    Windows 10 Access 2013 32bit
    Join Date
    Jul 2021
    Posts
    58
    I deleted the record source for wire and sleeves.
    The lookup for wire description and LeadSleeve diameter work as expected, but the colour is blank I put as the record source =[LeadSleeveCombo].[Column](3). Colour is the next column from diameter.
    Now I'm really lost as to why this does not work.

  8. #8
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,825
    If I remember correctly, the combobox is set for only 2 (or was it 3) columns. Change it to 4 and set widths 1";2";0";0"
    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.

  9. #9
    spidge32 is offline Advanced Beginner
    Windows 10 Access 2013 32bit
    Join Date
    Jul 2021
    Posts
    58
    Hi June7,Thank you for being so helpful. I'm a beginner and not all of these answers can be found in books.

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

Similar Threads

  1. Replies: 4
    Last Post: 03-11-2017, 09:48 PM
  2. Nz null not working in report from a combobox
    By caniread in forum Reports
    Replies: 2
    Last Post: 02-12-2016, 10:48 PM
  3. ComboBox, select null?
    By offie in forum Queries
    Replies: 2
    Last Post: 07-19-2013, 06:27 AM
  4. Set value of bound combobox to NULL
    By Kotoca in forum Forms
    Replies: 1
    Last Post: 06-30-2012, 02:27 PM
  5. Replies: 1
    Last Post: 02-23-2012, 02: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