PC Review


Reply
Thread Tools Rate Thread

dlookup with loop

 
 
deb
Guest
Posts: n/a
 
      5th Jan 2010
In my fSplashForm I have a button called btnCloseApprove.
I only want it visible if ContactUserID =48 and ContactStatus =Active. How
do I add ContactStatus to the below code.

One more issue...
When the Dlookup finds the first ContactUserID it stops looking. There may
be more than one instance of the ContactUserID. How do I make it check the
whole table for
ContactUserID =48 even though it may find a ContactUserID =45 or 43
or??(other)

If DLookup("[ContactSubID]", "[t14Contacts]", "[ContactUserID] = '" &
Environ("username") & "'") = 48 Or _
DLookup("[User_Type]", "[tblVersion]", "[UserID] = '" & Environ("username")
& "'") = "Admin" Then
Me.btnCloseApprove.Visible = True
Else
Me.btnCloseApprove.Visible = False
End If
--
deb
 
Reply With Quote
 
 
 
 
John W. Vinson
Guest
Posts: n/a
 
      5th Jan 2010
On Tue, 5 Jan 2010 14:01:01 -0800, deb <(E-Mail Removed)> wrote:

>In my fSplashForm I have a button called btnCloseApprove.
>I only want it visible if ContactUserID =48 and ContactStatus =Active. How
>do I add ContactStatus to the below code.
>
>One more issue...
>When the Dlookup finds the first ContactUserID it stops looking. There may
>be more than one instance of the ContactUserID. How do I make it check the
>whole table for
>ContactUserID =48 even though it may find a ContactUserID =45 or 43
>or??(other)
>
>If DLookup("[ContactSubID]", "[t14Contacts]", "[ContactUserID] = '" &
>Environ("username") & "'") = 48 Or _
>DLookup("[User_Type]", "[tblVersion]", "[UserID] = '" & Environ("username")
>& "'") = "Admin" Then
> Me.btnCloseApprove.Visible = True
>Else
> Me.btnCloseApprove.Visible = False
>End If


DLookUp returns only one value. That's how it's designed!

If you want to return multiple values, DLookUp is not the appropriate tool;
you'll want to create a Recordset based on a query. It's not quite clear what
you're trying to accomplish though!
--

John W. Vinson [MVP]
 
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 02:05 PM
VBA loop variable reference in dlookup criteria Bill (Unique as my name) Microsoft Access Forms 2 11th Jun 2006 05:32 PM
for to next loop with dlookup =?Utf-8?B?UGllcnJl?= Microsoft Access VBA Modules 2 2nd May 2006 03:13 AM
code help with do.. loop and dlookup in a report kaosyeti Microsoft Access VBA Modules 4 7th Feb 2006 02:09 AM
Dlookup problems (was my Dlookup hell) Kavvy Microsoft Access Form Coding 3 18th Nov 2003 12:16 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:43 PM.