Solved How to add more data in a drop down list box in form (1 Viewer)

hrdpgajjar

Registered User.
Local time
Today, 23:31
Joined
Sep 24, 2019
Messages
51
Hi there,
I've created a form with a list box which contains all my dealer names.. I've set the list box property to locked to list box value only and able to edit list box items manually.

Now my dealer list goes very long and after some count i am not able to edit or add more dealers to my list box.


Kindly guide me how can i get rid of this problem.


Thanks
 

ebs17

Well-known member
Local time
Today, 20:01
Joined
Feb 7, 2020
Messages
1,946
What is the RowSouce type?
A value list is delimited, a table/query is not.
Data in a table is also easier to maintain.
 
Last edited:

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 13:01
Joined
Feb 28, 2001
Messages
27,188
I'm with Eberhard on this one. A value list property is limited in length. You can decide for yourself by examining the "full" list box to see what is in it, but you will probably be limited to 255 characters for that property. If you convert the list to a table and fill the list box by a .RowSource query, you become limited by the maximum number of rows in a table, which in turn depends on what else is in the database - but you can easily get a few thousand entries in a list box. Oh, they become difficult as heck to manage when it gets that big - but it works. My personal biggest list box was over 1500 entries long.
 

Ranman256

Well-known member
Local time
Today, 14:01
Joined
Apr 9, 2015
Messages
4,337
the combo should be bound to a table/query. Do NOT use hardcoded value list
add items by entering them into the table
refresh the combo if it was left open to get the new values.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 14:01
Joined
May 21, 2018
Messages
8,529
I assume you are referring to a Combobox and not a Listbox. Comboboxes have Limit to List property, not listboxes.
1. Either way the names should be in a table. The combo or listbox bound to a query based on the dealer table.
2. Build a form for entering new dealier information
3. You can use the Not in List event, but I find that a pain and very limiting. I would simply put a little command button next to the list or combobox. Click on that button to pull up your edit form open it ACDIALOG

docmd.OpenForm "PopUpAddEditDealerFormName",,,,ACDIALOG
me.ComboOrListBoxName.requery
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 14:01
Joined
Feb 19, 2002
Messages
43,275
Most applications have a number of simple lookup lists. This isn't actually one. Along with Dealer name, don't you also need an address and contact info?
 

hrdpgajjar

Registered User.
Local time
Today, 23:31
Joined
Sep 24, 2019
Messages
51
What is the RowSouce type?
A value list is delimited, a table/query is not.
Data in a table is also easier to maintain.
Sorry for the late reply. But my RowSource type is Value List
 

ebs17

Well-known member
Local time
Today, 20:01
Joined
Feb 7, 2020
Messages
1,946
As you have probably read and realized by now, the limit for the value list is narrower than for the query. So what's stopping you from changing that?

Besides, it is much easier to maintain a table as the basis of the query. Tables are native elements in a database.
 

hrdpgajjar

Registered User.
Local time
Today, 23:31
Joined
Sep 24, 2019
Messages
51
As you have probably read and realized by now, the limit for the value list is narrower than for the query. So what's stopping you from changing that?

Besides, it is much easier to maintain a table as the basis of the query. Tables are native elements in a database.
I have only one table with all details and dealer name is one of the columns in my table. Now how can i've tried to create a separate table for dealer name only but i want to store dealer name in my table too. i am confused how can i do that as i am not a pro in access. Kindly Help me on this ... Thanks
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 14:01
Joined
May 21, 2018
Messages
8,529
You have a dealers table with a record for every dealer and a field that includes the dealer name. There is no need to create another table and that would be a bad idea. You can simply make a query that only selects the name column and sort by the name column. See demo
 
Last edited:

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 13:01
Joined
Feb 28, 2001
Messages
27,188
I have only one table with all details and dealer name is one of the columns in my table. Now how can i've tried to create a separate table for dealer name only but i want to store dealer name in my table too. i am confused how can i do that as i am not a pro in access. Kindly Help me on this ... Thanks

It sounds like you need to study a bit on queries. They are the absolute work-horses of Access. MajP suggested it first, but I'll explain it differently just so you get more than one viewpoint on the way to approach this problem.

If you have a table of dealers, addresses, and other dealer info, and all you really want is dealers, you just make a SELECT DISTINCT query and use it as the .RowSource of your combo or list box. If you use it in a combo, the .LimitToList allows you to run code asking you for the info to update the table, which you can do invisibly. Then, you .Requery the combo and select the row that you just added.

This whole thing works because what forms and reports and selection-oriented controls all REALLY want is called a recordset. You can get recordsets from tables - but you can get tailored recordsets from queries. Queries can present lists of things for you with multiple fields where needed, and can reformat fields for presentation purposes. They can impose order where order didn't exist. They can filter out unwanted data before presentation. All in all, queries are your friends. There are a FEW things you shouldn't do with queries - but there are a lot MORE things you can and should do with them.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 14:01
Joined
Feb 19, 2002
Messages
43,275
The limit to list property will allow you to specify a form to show when you want to add a new item to the list. The form is a standard form and should include all the necessary validation to ensure that the entry is valid and not a duplicate.
 

hrdpgajjar

Registered User.
Local time
Today, 23:31
Joined
Sep 24, 2019
Messages
51
The limit to list property will allow you to specify a form to show when you want to add a new item to the list. The form is a standard form and should include all the necessary validation to ensure that the entry is valid and not a duplicate.
does it stores unlimited data or i need to create a separate table to store data ?
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 14:01
Joined
Feb 19, 2002
Messages
43,275
I have an entire mini-app that I add to all new applications that is used to manage simple lookup tables so I don't create new tables and forms for each lookup I have to manage. However, many people do. If you want the mini-app, it is in the database section where you can download it.

Whenever you have more than a couple of items in a combo or listbox OR you need to allow users to add/change/delete items from the list, you should use a table. Otherwise, you have no way of sorting the list and you have no way of preventing users from deleting or modifying items in the list. At least with a table, you can use a form that controls what the user can do with existing items in the list. They should NEVER, EVER be able to delete or rename existing items. Renaming is allowed in the mini-app since it isn't the text that is stored, it is the uniqueID. Changing the text doesn't change the ID so no existing record ever gets changes if you change the text. You see the new text when you look at the record but the ID that is stored is still the original value.
 

hrdpgajjar

Registered User.
Local time
Today, 23:31
Joined
Sep 24, 2019
Messages
51
It sounds like you need to study a bit on queries. They are the absolute work-horses of Access. MajP suggested it first, but I'll explain it differently just so you get more than one viewpoint on the way to approach this problem.

If you have a table of dealers, addresses, and other dealer info, and all you really want is dealers, you just make a SELECT DISTINCT query and use it as the .RowSource of your combo or list box. If you use it in a combo, the .LimitToList allows you to run code asking you for the info to update the table, which you can do invisibly. Then, you .Requery the combo and select the row that you just added.

This whole thing works because what forms and reports and selection-oriented controls all REALLY want is called a recordset. You can get recordsets from tables - but you can get tailored recordsets from queries. Queries can present lists of things for you with multiple fields where needed, and can reformat fields for presentation purposes. They can impose order where order didn't exist. They can filter out unwanted data before presentation. All in all, queries are your friends. There are a FEW things you shouldn't do with queries - but there are a lot MORE things you can and should do with them.
Sorry for the late reply, but it worth it. Finally I've learned a lot about applying table/query in row source in combo box and my problem solved finally :). Thanks for the great suggestion.
 

Users who are viewing this thread

Top Bottom