AllExperts > Using MS Access 
Search      
Using MS Access
Volunteer
Answers to thousands of questions
 Home · More Using MS Access Questions · Answer Library  · Encyclopedia ·
More Using MS Access Answers
Question Library

Ask a question about Using MS Access
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Scottgem
Expertise
I can answer almost all types of questions relating to Microsoft Access usage and application design. My strengths are database and interface design.

Experience
I've been designing databases for over 15 years working with dBase, FoxPro, Approach and Access.

Organizations
Author of Microsoft Office Access 2007 VBA
Techncial Editor for Special Edition Using Microsoft Access 2007 and Access 2007 Forms, Reports & Queries From Que Publishing

 
   

You are here:  Experts > Computing/Technology > Business Software > Using MS Access > Auto populate fields

Using MS Access - Auto populate fields


Expert: Scottgem - 7/9/2009

Question
QUESTION: I have a multi-column combobox in a form that I want to have autoupdate 3 text fields.  i have followed the suggestions found on the microsoft website and it works, BUT when i try it, it autoupdates all the other records in my table. FYI the combobox derives its information from 2nd table called products (other columns are itemnumber, UOM, cost).  my form is called rejects

ANSWER: I wrote an article on this issue which can be found here:
http://www.utteraccess.com/forums/showflat.php?Cat=&Board=53&Number=1265454&Zf=f...

There are two issues here. As the article says you should not be duplicating data. However, at least one of your fields is one of the exceptions to this rule, that would be the Cost field. The other two controls (not fields) should be unbound and just display the related data, probably using the Column property. However, the cost control should be bound and you should populate it using the the After Update event of the combo like so:

Me.txtCost = Me.cboProduct.Column(x)

Hope this helps,
Scott<>

---------- FOLLOW-UP ----------

QUESTION: Hi Scott, the data is not being duplicated.  Right now, the TblProduct stores information on all products that I deal with (name,unit of measure, cost) this information does not change often hence the separate table.  My main table is Rejects.  This is where all the other information is stored (owners, dates, times, etc).  My problem was i wanted to make the UOM, Cost and Item Number autopopulated because other users kept inputting the numbers wrong (or wrong UOM, instead of KG they would put GM).  I set up the VGA code as below, however, it changes all the records, not just the current active record.  


Private Sub ItemDescription_AfterUpdate()
   Me.ItemNumber = Me.ItemDescription.Column(2)
   Me.UOM = Me.ItemDescription.Column(3)
   Me.Cost = Me.ItemDescription.Column(4)


Answer
I think the problem here is that you are using unbound controls. When you set the value of an unbound control in a form set for continuous form mode, all the unbound controls will reflect the same value.

If you are using unbound controls, then you are right that data isn't being duplicated. But if that's the case, don't assign the value to the controls, set the Controlsource to the column like so:

=[ItemDescription].Column(2)

I would like to see the RowSource of the ItemDescription combo as well as the Bound column. I'm not sure if you have that correct.

Hope this helps,
Scott<>
Microsoft Access MVP 2007
Author: Microsoft Office Access 2007 VBA

Add to this Answer   Ask a Question


 
User Agreement | Privacy Policy | Kids' Privacy Policy | Help
Copyright  © 2008 About, Inc. AllExperts, AllExperts.com, and About.com are registered trademarks of About, Inc. All rights reserved.