Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2009

    Unanswered: Trying to leave blank in combobox

    I have a combobox which I want to be able to leave a blank rather than a item in the list. The field is a autonumber field. But I get a "You tried to assign the Null value to a variable that is not a Variant data type" error. I have limit to list property set to no.

  2. #2
    Join Date
    Dec 2004
    Madison, WI
    Not a good idea to make the autonumber field a combobox (Why would you ever need to "edit" a field that is not editable anyway?)

    If you are trying to make a "search" type field, make a new unbound combobox and then set the focus to the autonumber field to do your "Docmd.FindRecord" (or changing your recordsource.)

    ex: (FComboboxName is my unbound combobox and my autonumber field is the 1st column and my name is the 2nd column)

    Private sub FComboboxName_AfterUpdate()
    Docmd.FindRecord me!FComboboxName
    End sub

    The above example is assuming you're opening the form with ALL records as you can only "find" records within the recordsource of the form.
    Last edited by pkstormy; 08-04-09 at 20:55.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  3. #3
    Join Date
    Mar 2009
    Provided Answers: 15
    As pkstormy wrote above, what you try to do is not a very good idea, at least if I understand your question correctly.

    However, for inserting an "extra" row into a list or a combo, see: Forms: Adding "All" to a listbox or combobox

    Have a nice day!

Posting Permissions

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