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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Dlookup with multiple criteria??
access2003
How can I make the textbox field"PassedQGDt" on form f015KeyMilestones" enabled if MSPContactUserID=Environ("username") and the MSPTitleID=8 (number) Check the Environ("username") against the MSPContactUserID and the MSPTitleID=8 The user can have many MSPTitleID's ( it is a role table) and user can have many roles, so it must search the table for both criteria and not just the first MSPContactUserID . Table is "t41ContactsMSP" (PK-MSPContactID number). Table set up like... MSPContactID.............MSPTitleID.............MS PContactUserID 1.......................................1......... .......................abcabc 2.......................................1......... .......................defdef 3.......................................8......... .......................abcabc Your help us very appreciated!!! -- deb |
#2
|
|||
|
|||
Dlookup with multiple criteria??
"deb" wrote in message
... access2003 How can I make the textbox field"PassedQGDt" on form f015KeyMilestones" enabled if MSPContactUserID=Environ("username") and the MSPTitleID=8 (number) Check the Environ("username") against the MSPContactUserID and the MSPTitleID=8 The user can have many MSPTitleID's ( it is a role table) and user can have many roles, so it must search the table for both criteria and not just the first MSPContactUserID . Table is "t41ContactsMSP" (PK-MSPContactID number). Table set up like... MSPContactID.............MSPTitleID.............MS PContactUserID 1.......................................1......... .......................abcabc 2.......................................1......... .......................defdef 3.......................................8......... .......................abcabc Your help us very appreciated!!! If I've understood you correctly, this would do it: Me.PassedQGDt.Enabled = _ Not IsNull( _ DLookup( _ "MSPContactID", _ "t41ContactsMSP", _ "MSPTitleID=8 And MSPContactUserID=""" & _ Environ("username") & """" _ ) _ ) -- Dirk Goldgar, MS Access MVP Access tips: www.datagnostics.com/tips.html (please reply to the newsgroup) |
#3
|
|||
|
|||
Dlookup with multiple criteria??
Additionally I'd recommend against using the environmental variable to get
the current user. It's not totally reliable as environmental variables can be changed. Instead add the following module to the database: ' module basGetUser Option Compare Database Option Explicit Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal _ lpBuffer As String, nSize As Long) As Long Public Function GetUser() As String Dim strBuffer As String Dim lngSize As Long, lngRetVal As Long lngSize = 199 strBuffer = String$(200, 0) lngRetVal = GetUserName(strBuffer, lngSize) GetUser = Left$(strBuffer, lngSize - 1) End Function then in instead of calling Environ("username") call GetUser(). Ken Sheridan Stafford, England deb wrote: access2003 How can I make the textbox field"PassedQGDt" on form f015KeyMilestones" enabled if MSPContactUserID=Environ("username") and the MSPTitleID=8 (number) Check the Environ("username") against the MSPContactUserID and the MSPTitleID=8 The user can have many MSPTitleID's ( it is a role table) and user can have many roles, so it must search the table for both criteria and not just the first MSPContactUserID . Table is "t41ContactsMSP" (PK-MSPContactID number). Table set up like... MSPContactID.............MSPTitleID.............M SPContactUserI 1.......................................1........ ........................abcab 2.......................................1........ ........................defde 3.......................................8........ ........................abcabc Your help us very appreciated!!! -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...ccess/201005/1 |
Thread Tools | |
Display Modes | |
|
|