![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have a calculated field on a form with the following as its controlsource. =DLookUp("BupaID","Lookups_UserT","Category='Provi der number' AND Details='" & [ProviderNumber] & "'") This looks up a value in a lookup table based on another value in the form. The [ProviderNumber] field is bound to the form's recordsource. This works fine except that when the form is opened the value is not visible in the field until you click on the field. I can't work out how to get the value to appear automatically. I've tried .requery and .repaint on the field and form to no avail. |
#3
| |||
| |||
|
|
I have a calculated field on a form with the following as its controlsource. =DLookUp("BupaID","Lookups_UserT","Category='Provi der number' AND Details='" & [ProviderNumber] & "'") This looks up a value in a lookup table based on another value in the form. The [ProviderNumber] field is bound to the form's recordsource. This works fine except that when the form is opened the value is not visible in the field until you click on the field. I can't work out how to get the value to appear automatically. I've tried .requery and .repaint on the field and form to no avail. |
#4
| |||
| |||
|
|
I have a calculated field on a form with the following as its controlsource. =DLookUp("BupaID","Lookups_UserT","Category='Provi der number' AND Details='" & [ProviderNumber] & "'") This looks up a value in a lookup table based on another value in the form. The [ProviderNumber] field is bound to the form's recordsource. |
#5
| |||
| |||
|
|
Move the DLookUp to the form's on current event; fill the control with the returned value. DLookUp is very slow, you may want to replace it with eLookup. I use the one from Allen Browne. abrowne1 (AT) bigpond (DOT) net.au "Owen" <google (AT) healthbase (DOT) com.au> wrote in message news:0da92a5f-323d-415d-9abb-4457b4eadadb (AT) v35g2000prn (DOT) googlegroups.com... I have a calculated field on a form with the following as its controlsource. =DLookUp("BupaID","Lookups_UserT","Category='Provi der number' AND Details='" & [ProviderNumber] & "'") This looks up a value in a lookup table based on another value in the form. The [ProviderNumber] field is bound to the form's recordsource. This works fine except that when the form is opened the value is not visible in the field until you click on the field. I can't work out how to get the value to appear automatically. I've tried .requery and .repaint on the field and form to no avail. |
#6
| |||
| |||
|
#7
| |||
| |||
|
|
Thanks for all the responses. Salad - Nz() makes no difference. Requery makes no difference. Ron - moving DLookup to the Current event worked. Thanks. Thanks for the eLookup tip. David - using the lookup value in the recordsource renders the form data uneditable. Phil - thanks, I'll look at using eLookup in future. I'm still mystified as to why the calc field would not display the value, since it is there when you click the field. But I'll go with Ron's method to get around it. Thanks all. Owen |
#8
| |||
| |||
|
|
I always use Elookup instead of Dlookup as well as EMax, EMin etc. I tried to test the difference in speed in AK2 some time ago and found very little difference. Almost certainly wrong, but could this be a myth? Phil |
#9
| |||
| |||
|
|
RESPONDING TO "...could this be a myth?" The domain functions (DLookup, DMax, DMin, etc.) are relatively slow, but you only notice the "slowness" when you are calling them multiple times in a loop of some kind. Or if you are calling them in a query and returning a lot of records or are filtering on the result of the function call. For one record I doubt that you could detect much difference (if any) between Allen Browne's functions and the built-in functions. The enhanced abilities of Allen's functions are of real benefit and the use of the enhanced abilities might (I've not tested this) actually make them a bit slower. John Spencer Access MVP 2002-2005, 2007-2010 The Hilltop Institute University of Maryland Baltimore County I always use Elookup instead of Dlookup as well as EMax, EMin etc. I tried to test the difference in speed in AK2 some time ago and found very little difference. Almost certainly wrong, but could this be a myth? Phil |
#10
| |||
| |||
|
|
Thanks for all the responses. Salad - Nz() makes no difference. Requery makes no difference. Ron - moving DLookup to the Current event worked. Thanks. Thanks for the eLookup tip. David - using the lookup value in the recordsource renders the form data uneditable. Phil - thanks, I'll look at using eLookup in future. I'm still mystified as to why the calc field would not display the value, since it is there when you click the field. But I'll go with Ron's method to get around it. Thanks all. Owen |
![]() |
| Thread Tools | |
| Display Modes | |
| |