A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

DLookUp



 
 
Thread Tools Display Modes
  #1  
Old January 26th, 2010, 02:27 PM posted to microsoft.public.access.forms
JCA
external usenet poster
 
Posts: 8
Default DLookUp

I have a form (Randomisation) with 3 fields – Cohort, Participant ID, and Box
Number. I want to fill Box Number with a value from a separate table
(Randomisation List). The Box Number to be selected is contingent on the
Cohort (HG or CG) and each Box Number is to be used only once. I’ve tried the
following in the default value and also in control source (which is correct?):

=DLookUp([Randomisation List]![Box Number],[Randomisation
List]![Cohort]=[Cohort (HG/CG)] And [Randomisation List]![Used?]=No)

But I’m just getting #Name?. I’m also conscious that once I do get this to
work, I need to set [Randomisation List]![Used] to Yes for that record, and
I’d also like to copy the Participant ID from the current record in
[Randomisation] to the selected record in [Randomisation List].



  #2  
Old January 26th, 2010, 02:49 PM posted to microsoft.public.access.forms
Daryl S[_2_]
external usenet poster
 
Posts: 881
Default DLookUp

JCA -

Look at the help for DLookUp. I have adjusted this to what I think you need.
Try this:

=DLookUp("[Randomisation List]![Box Number]","[Randomisation List]",
"[Cohort]=" & [Cohort (HG/CG)] & " And [Used?]='No'")

--
Daryl S


"JCA" wrote:

I have a form (Randomisation) with 3 fields – Cohort, Participant ID, and Box
Number. I want to fill Box Number with a value from a separate table
(Randomisation List). The Box Number to be selected is contingent on the
Cohort (HG or CG) and each Box Number is to be used only once. I’ve tried the
following in the default value and also in control source (which is correct?):

=DLookUp([Randomisation List]![Box Number],[Randomisation
List]![Cohort]=[Cohort (HG/CG)] And [Randomisation List]![Used?]=No)

But I’m just getting #Name?. I’m also conscious that once I do get this to
work, I need to set [Randomisation List]![Used] to Yes for that record, and
I’d also like to copy the Participant ID from the current record in
[Randomisation] to the selected record in [Randomisation List].



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:48 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.