Go Back   Access World Forums > Microsoft Access Discussion > Forms

Thread Tools Rate Thread Display Modes
Old 07-11-2011, 07:47 PM   #1
Newly Registered User
Join Date: Jul 2011
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
sguan is on a distinguished road
Auto-Assign a value to a combobox based on a previous combobox entry

I am a fresh beginner in Access so please take my apologies if I haven't explained the below issue clear enough and let me know so that I can further explain it in moer details.

I have two comboboxes; Combo A and Combo B, coming from the same record-saving table but within that table they are coming from two separate, independent tables.

I would like to autoassign a value to Combo B when the user selects a value in Combo A which has been selected before. The value I would like to assign to B should be the same as the value the user selected in Combo B in the previous record when he selected the same value for Combo A. This means those two combinations of Combo A and Combo B should be the same.

Im doing this to save time and make it easier for the user so they don't have to repeatedly selecting a combination which is identical to previous ones.

I would apperciate if someone can provide me the VBA code for this function.

Thanks so much in advance!

sguan is offline   Reply With Quote
Old 07-15-2011, 09:36 AM   #2
GinaWhipp's Avatar
Join Date: Jun 2011
Location: Ohio, USA
Posts: 5,260
Thanks: 20
Thanked 869 Times in 854 Posts
GinaWhipp has a spectacular aura about GinaWhipp has a spectacular aura about
Re: Auto-Assign a value to a combobox based on a previous combobox entry

Perhaps you can make this work for you...

Private Sub YourField_AfterUpdate()
     Me.YourField.DefaultValue = """" & Me.YourField.Value & """"
End Sub
Gina Whipp
Microsoft MVP (Access 2010-2015)

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
GinaWhipp is offline   Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Limiting Combobox Values based on Selection in previous subform record??? Kroghr Forms 2 04-17-2010 09:28 AM
Dynamically Updated Combobox based upon previous selections deadtrees Queries 1 02-01-2010 06:51 PM
combobox based on previous combobox jarheadjim Forms 1 01-25-2006 12:12 PM
Query for a month range based on combobox entry sponge General 2 08-07-2005 08:30 PM
Combobox won't auto-search when multiple periods are in entry KeithIT Forms 2 07-29-2005 08:53 AM

All times are GMT -8. The time now is 03:33 PM.

Microsoft Access Help
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post

Sponsored Links

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World