Results 1 to 14 of 14
  1. #1
    3 Star Lounger
    Join Date
    May 2003
    Location
    Sacramento, California, USA
    Posts
    310
    Thanks
    0
    Thanked 0 Times in 0 Posts

    ComboBox question (A2k)

    I have a combo box on a form that gets it's list from a table. I'm trying to set the LimitToList property to No, and I'm getting this error message:
    "The first visible column which is determined by the ColumnWidths property, isn't equal to the bound column. Adjust the ColumnWidths property first, and then set the LimitToList property." I've not been able to figure this out after trying what seems logical and following the help menu. Any help?

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

    Re: ComboBox question (A2k)

    Hi Gabi,

    I would guess that the table behind the combo box has some kind of ID / AutoNumber field that is hidden by setting the column width of the first column to 0. So the user sees the second (or even later) column. When the user selects an entry, the ID corresponding to this entry is stored in the control source of the combo box. In other words, the combo box stores a value that is different from the displayed value.

    If you set the Limit To List property to No, you allow the user to enter a value that is not an entry in the list. But that is not the value you need to store, you need an ID for that. That is why you get the error message.

    If you want the user to be able to enter "new" values, you must leave Limit To List set to No, and create code in the On Not In List event of the combo box that inserts the new value into the table, then tells Access that you have added the value. Post back if you need this.

  3. #3
    3 Star Lounger
    Join Date
    May 2003
    Location
    Sacramento, California, USA
    Posts
    310
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: ComboBox question (A2k)

    This was what I suspected. I will need the code <img src=/S/please.gif border=0 alt=please width=31 height=23> !

    Thanks!

  4. #4
    2 Star Lounger
    Join Date
    Sep 2001
    Location
    Wellington, Wellington, New Zealand
    Posts
    181
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: ComboBox question (A2k)

    Hi

    Not sure whether you were asking for code or not, but attached are 3 ways of doing this. I think I gleaned them from this forum.

    Regards
    WTH
    Attached Files Attached Files

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

    Re: ComboBox question (A2k)

    Basically, the code on page 2 of the document posted by WTH shows what you need. If you would like more specific assistance, please provide details of your situation:

    - Name of the combo box
    - Name of the table that acts as row source of the combo box.
    - Names of the fields in this table, and their data type (number, text, date, ...)

  6. #6
    3 Star Lounger
    Join Date
    May 2003
    Location
    Sacramento, California, USA
    Posts
    310
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: ComboBox question (A2k)

    I'm gonna try and figure it out with WTH's help (Thanks!!) by putting my control and table names in, if I can't get it, I'll let you know.

  7. #7
    3 Star Lounger
    Join Date
    May 2003
    Location
    Sacramento, California, USA
    Posts
    310
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: ComboBox question (A2k)

    Okay, I've got the code in, and when I go to compile, I get the following error message:"Compile Error: User defined type not defined", and highlighted behind this message is the variable declaration "dbs As DAO.Database", without the quotes. From the help files, I'm not sure how to declare this.

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

    Re: ComboBox question (A2k)

    From <post#=300686>post 300686</post#> earlier today:

    That's easy to solve. Select Tools | References... (in the VB Editor), locate and check Microsoft DAO 3.6 Object Library, then click OK.

  9. #9
    3 Star Lounger
    Join Date
    May 2003
    Location
    Sacramento, California, USA
    Posts
    310
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: ComboBox question (A2k)

    Got it, thanks!

  10. #10
    3 Star Lounger
    Join Date
    May 2003
    Location
    Sacramento, California, USA
    Posts
    310
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: ComboBox question (A2k)

    That worked like a charm, but after typing in the info that's not in the list the record records it and then sends me directly to a blank record. Do I need to remove the "rst.Close" after End If?

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

    Re: ComboBox question (A2k)

    No, you shouldn't remove rst.Close! You may run into problems if you do.

    Is the combo box the "last" control on the form?

  12. #12
    3 Star Lounger
    Join Date
    May 2003
    Location
    Sacramento, California, USA
    Posts
    310
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: ComboBox question (A2k)

    No it's somewhere in the middle. I tried SetFocus to the next control (after End If), it's also a combo box based on a lookup table, and it wouldn't let me do it.

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

    Re: ComboBox question (A2k)

    With the form open in design view, select View | Tab Order...
    I suspect that even if the combo box is "somewhere in the middle", it is listed last in the Tab Order dialog. If so, you can move it up in the list by selecting it, then dragging it to the desired position in the tab order.
    Alternatively, you can set the Cycle property of the form to Current Record instead of All Records.

  14. #14
    3 Star Lounger
    Join Date
    May 2003
    Location
    Sacramento, California, USA
    Posts
    310
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: ComboBox question (A2k)

    Well Gosh Darn, I thought about trying that but didn't think it could be that simple!

    Thanks Hans!

Posting Permissions

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