Unanswered: How to get a dlookup value on a form into the form's underlying table
I have a data entry form based on a 'Shareholdings' table. One of the fields on the form is populated from a different table using dlookup.
Because the control source for this particular field contains the lookup expression, it's no longer linked to its underlying field in the shareholdings table - how can I get the auto populated value for that field on the form back into it's associated field in the table?
Am I going about this the wrong way?
I have to admit that I would rarely reccommed using DLookup function.
It sounds like you are using a bound form. If so do the following
1. Create a query based on the other table, where your lookup values are
2. Put a combo box on your data entry form that is bound to the field you want in the main table (control Source)
3. Tie the combo bax to the query to get the list of valid choices (Row Source)
Then when you select you choice in the combo box, it will act just like you typed it into a text box.
Thanks - had a look, and it certainly sounds like a better way to approach this. What I didn't mention in my post is that the possible values for the 'lookup' field are determined by a selection the user makes in another combo box in the same record. Easy enough to solve using dlookup, but as mentioned, I can't do anything with the values once they're displayed.
Using your combo box idea rather than a dlookup to display the required values looks like the way to go - now I have to work out how to limit the selectable values in the 2nd combo based on the selection made in the first. I've seen posts in here dealing with the same problem - being a novice in Access and db's in general, the thoughts of deciphering VB code is a bit daunting - this could take a while.
Hi sbaxter - I tried setting the value of combo2 in an afterupdate event contained in combo1, but that's giving me a blank dropdown in combo2 when I run it. Dunno if it's a problem with the syntax (I have zero VB experience). I've put the details in a seperate post on here if your arsed taking a look...