Link to home
Start Free TrialLog in
Avatar of PhxDB
PhxDBFlag for United States of America

asked on

DLookup Revisited

I have a form which uses a pull-down list (QueryPending query) for the field "Key".  From that field I populate 4 fields on the form using the attached code ... then the user enters some additional data and we have a good record.  

This had been working just fine, but is no longer pulling data and I cannot find what went wrong.  I have checked & rechecked the Query and all of the fields entered are correct; The "Key" field is the bound column on the pull-down list etc ... but none of the 4 are working.

Any thoughts?  Thanks.
DLookup-Code.pdf
Avatar of PhxDB
PhxDB
Flag of United States of America image

ASKER

Using MS-Access 2010
Avatar of peter57r
Your code requires that you click into each of the 4 textboxes in order to see their values.Are you definitely doing that?

A better way would be to put all the code in the afterupdate event procedure of the combobox.  The textboxes would then fill without any further action.
Your code looks fine.

Has anything about your Key combo box changed?  If Key is a numeric data type, then you need to leave out the single quote delimiters.

That said... are the textboxes you are populating unbound or are they bound to a field in some table?

If they are unbound, Id recommend this approach instead:

-  Include all of those fields in the rowsource of your combo box
- Set the control sources of your textboxes like this:
      = [Key].Column(2)
      = [Key].Column(3)
etc

(Note that column numbers are zero-based, so column(0) refers to the first column)

You can hide these extra columns by setting their widt properties to zero.
Avatar of PhxDB

ASKER

Thanks, Peter - I actually came up with that idea too while trying to figure out why it wouldnt work ... but it seems like Mbizup's comment will correct that as well.

Mbizup - Believe we are really close now.  Didnt mention that I want the form to save the Key, Item, Category & WBS to the underlying Table of the form (Transactions).  Since I changed the control source as you suggested, the key is hitting that Table ... but not the other 3 that I changed.  Is there a way to do both?  Thanks again!
ASKER CERTIFIED SOLUTION
Avatar of mbizup
mbizup
Flag of Kazakhstan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of PhxDB

ASKER

You are correct of course ... in the process of changing the table structure.  Thanks for the reminder (read: kick in the butt).  Appreciate the help!