Go Back   Access World Forums > Microsoft Access Discussion > Forms

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 07-11-2011, 07:47 PM   #1
sguan
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
AWF VIP
 
GinaWhipp's Avatar
 
Join Date: Jun 2011
Location: Ohio, USA
Posts: 5,009
Thanks: 19
Thanked 835 Times in 820 Posts
GinaWhipp will become famous soon enough GinaWhipp will become famous soon enough
Re: Auto-Assign a value to a combobox based on a previous combobox entry

Perhaps you can make this work for you...

Code:
 
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
Reply

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 05:01 AM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Sponsored Links

How to advertise

Media Kit


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