UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Is It Possible To Add New Records To A Lookup Column?, Office 2007    
 
   
CaliKidd
post Nov 17 2011, 02:23 PM
Post #1

UtterAccess Member
Posts: 48



I am using a lookup table to load values into a combobox to simplify data entry. Works great, but it limits me to the list. I tried change the "limit to list" property from Yes To No, but Access gave me an error message that says "The first visible column, which is determined by the Column Widths property, isn't equal to the bound column. Adjust the ColumnWidths property first and then set the LimitToList property."

The lookup table I am using is [States_Provinces]. It only has two fields - the [StateID], which is the primary key, and [State]. The values in the table are the 50 2-digit state abbreviations (e.g., CA for California).

Access seems to be complaining that the first visible column (I assume this is the State) isn't equal to the bound column (which I assume is the PK)? I played around with the ColumnWidth field, but couldn't figure out how to resolve this.

In summary, I want the user to be allowed to enter a new value if it is not on the list;e.g., PR for Puerto Rico. Once the value is entered into the lookup table, I want it to be available for future lookups. In other words, I've saved the user a lot work by providing 50 state abbreviations, but I want the user to be able to "grow" that list by adding values when it's needed (e.g., GU for Guam, VI for Virgin Islands, BC for British Columbia (if Canada), etc.)

Can someone please tell me how I can do this?
Go to the top of the page
 
+
trapperalexander
post Nov 17 2011, 02:31 PM
Post #2

UtterAccess VIP
Posts: 2,135
From: Plano, TX



HERE is a link that may be helpful. basically you use the 'not in list' EVENT of your combobox control. when a user enters something not in the list, the event fires and asks the user if they want to add it, then if they do, the code adds the value to the lookup table and sets the value of the combobox.

hope this helps.
Go to the top of the page
 
+
CaliKidd
post Nov 17 2011, 03:08 PM
Post #3

UtterAccess Member
Posts: 48



Thanks Trapper, I didn't realize I had to use VBA to accomplish this... but I am glad there is a way. I'll give it a try!
Go to the top of the page
 
+
trapperalexander
post Nov 17 2011, 03:13 PM
Post #4

UtterAccess VIP
Posts: 2,135
From: Plano, TX



if you havent done any VBA coding and would like some help just let me know. I would be happy to assist and explain.
Go to the top of the page
 
+
CaliKidd
post Nov 17 2011, 03:20 PM
Post #5

UtterAccess Member
Posts: 48



Thanks for the offer to help, Trapper. Fortunately, I learned VBA in the Excel world, so I'll be OK, but thanks again. I am just now learning Access' object model and wasn't sure what could be done directly through Access' GUI vs what I would need to code.
Go to the top of the page
 
+
theDBguy
post Nov 17 2011, 03:31 PM
Post #6

Access Wiki and Forums Moderator
Posts: 47,919
From: SoCal, USA



Hi,

QUOTE (CaliKidd @ Nov 17 2011, 01:20 PM) *
Thanks for the offer to help, Trapper. Fortunately, I learned VBA in the Excel world, so I'll be OK, but thanks again. I am just now learning Access' object model and wasn't sure what could be done directly through Access' GUI vs what I would need to code.

Pardon me for jumping in...

If you want to stick with the GUI, you can try using the List Items Edit Form property.

Basically, you would create a separate data entry form for the lookup table and then select that form's name in the List Items Edit Form property of the Combobox.

Just my 2 cents... (IMG:style_emoticons/default/2cents.gif)
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 19th May 2013 - 10:45 PM