PC Review


Reply
Thread Tools Rate Thread

Error in Dlookup formula

 
 
Tony Williams
Guest
Posts: n/a
 
      9th Feb 2009
I have a form (frmmain) which has a subform (frmInput) and 3 controls on the
subform.
Control 1 is a drop down combo box based on a table (not the same one as the
form)
Control source of Control 2 is Control1.column(2)
Control source of Control 3 is
=DLookUp("[ADDRESS]","[Codes]","[Unitname]=Forms![frmmain]![frmInput].Form![control2]

However I'm getting #Error in Control 3
Can anyone help?
Thanks
Tony
 
Reply With Quote
 
 
 
 
Allen Browne
Guest
Posts: n/a
 
      9th Feb 2009
Some alternative expressions for the 3rd argument to try, Tony:
"[Unitname]=[control2]"
"[Unitname]=Control1.column(2)"
"[Unitname] = """ & Control1.column(2) & """"

If Unitname is a Number field (not a Text field), drop the quotes and handle
the Null case:
"[Unitname] = " & Nz(Control1.column(2),0)

If the subform has no records and no new records can be added, it goes blank
and these expressions will error.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Tony Williams" <(E-Mail Removed)> wrote in message
news:E7C35788-734D-4D0D-B0E5-(E-Mail Removed)...
>I have a form (frmmain) which has a subform (frmInput) and 3 controls on
>the
> subform.
> Control 1 is a drop down combo box based on a table (not the same one as
> the
> form)
> Control source of Control 2 is Control1.column(2)
> Control source of Control 3 is
> =DLookUp("[ADDRESS]","[Codes]","[Unitname]=Forms![frmmain]![frmInput].Form![control2]
>
> However I'm getting #Error in Control 3
> Can anyone help?
> Thanks
> Tony


 
Reply With Quote
 
 
 
 
Tony Williams
Guest
Posts: n/a
 
      9th Feb 2009
Thanks Allen used the second suggestion
Tony

"Allen Browne" wrote:

> Some alternative expressions for the 3rd argument to try, Tony:
> "[Unitname]=[control2]"
> "[Unitname]=Control1.column(2)"
> "[Unitname] = """ & Control1.column(2) & """"
>
> If Unitname is a Number field (not a Text field), drop the quotes and handle
> the Null case:
> "[Unitname] = " & Nz(Control1.column(2),0)
>
> If the subform has no records and no new records can be added, it goes blank
> and these expressions will error.
>
> --
> Allen Browne - Microsoft MVP. Perth, Western Australia
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
> "Tony Williams" <(E-Mail Removed)> wrote in message
> news:E7C35788-734D-4D0D-B0E5-(E-Mail Removed)...
> >I have a form (frmmain) which has a subform (frmInput) and 3 controls on
> >the
> > subform.
> > Control 1 is a drop down combo box based on a table (not the same one as
> > the
> > form)
> > Control source of Control 2 is Control1.column(2)
> > Control source of Control 3 is
> > =DLookUp("[ADDRESS]","[Codes]","[Unitname]=Forms![frmmain]![frmInput].Form![control2]
> >
> > However I'm getting #Error in Control 3
> > Can anyone help?
> > Thanks
> > Tony

>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Dlookup function - copying the dlookup info into a field.... Douglas J. Steele Microsoft Access Forms 0 6th Dec 2006 03:05 PM
dlookup or not dlookup... =?Utf-8?B?bHVsYQ==?= Microsoft Access 5 24th Nov 2005 08:24 AM
Dlookup within a Dlookup =?Utf-8?B?RGFuaWVs?= Microsoft Access VBA Modules 1 7th Jul 2004 02:57 PM
Dlookup problems (was my Dlookup hell) Kavvy Microsoft Access Form Coding 3 18th Nov 2003 01:16 PM
Dlookup or not dlookup Bruce Ritchie Microsoft Access 2 7th Nov 2003 01:50 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:47 AM.