Full Version: datasheet form and variable issue
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
tonez90
Hi I have a datasheet subform which lists out licence type.
In my Usysref_licence file I store the codes and descriptions for each licence type.

when I open the subform in datasheet mode all the descriptions are the same. if opened in form view there is no problem. I use the dlookup function:

Me!Licence_description = DLookup("NLC_Description", "UsysRef_National_Licence_Classes", "[NLC_CODE] Like '" & Me!Assessor_licence_type & "'")

How do I get the form to populate the description based on the NLC_code. I have tried the form_current function the Afterupdate function etc but to no avail. If I click on the appropriate code the whole datasheet descriptions change to the current record one and so on. I dont store the description merely place it there for the user to see.

Any help would be appreciated.

Tonez90
Jack Cowley
Change the License control on the subform to a combo box and base the combo box on your table Usysref_License table. I assume you save the PK for each license type in the table your subform is based on....

My best guess....

hth,
Jack
Peter46
Set the controlsource of the textbox to the dlookup function (modified to use full forms references ), instead of using code.
tonez90
Thanks for pointer. So is this correct for the dlookup (control source)
=DLookup("NLC_Description", "UsysRef_National_Licence_Classes", "[NLC_CODE] = '" & Assessor_licence_type & "'")

and appears to work thanks for your help
Jack Cowley
This article should answer your DLookup() syntax questions....

hth,
Jack
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.