Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CurrentUser Select statement

Status
Not open for further replies.

corbinap

Programmer
Nov 20, 2006
34
US
I am not ending the Select statement below correctly - can someone help? "WHERE (((tblUsers.UserID)='"&[CurrentUser]))&"'"



Also I am trying to query the currentuser to find who signed in for the approval limits. Can I use currentuser in the Select Case below?

Set rst = CurrentProject.Connection.Execute("SELECT tblUsers.MgrID, tblSourcingManagers.SourcingMgrLast" & _
"FROM tblSourcingManagers INNER JOIN tblUsers ON tblSourcingManagers.SourcingMgrID = tblUsers.SourcingMgrID" & _
"WHERE (((tblUsers.UserID)='"&[CurrentUser]))&"'"


Select Case CurrentUser
Case "SM"
ApprovalLimit = 300000
Case "DIR"
ApprovalLimit = 1500000
Case "VP1"
ApprovalLimit = 3000000
Case "EVP"
CanApprove = True
Exit Function
 
How are ya 10doesch . . .

. . . and this:
Code:
[blue]   Dim SQL As String
   
   SQL = "SELECT tblUsers.MgrID, A.SourcingMgrLast " & _
         "FROM tblSourcingManagers AS A " & _
         "INNER JOIN tblUsers " & _
         "ON A.SourcingMgrID = tblUsers.SourcingMgrID " & _
         "WHERE (tblUsers.UserID='" & [CurrentUser] & ")'"
   Set rst = CurrentProject.Connection.Execute(SQL)[/blue]

Calvin.gif
See Ya! . . . . . .
 
10doesch . . .

BTW: [blue]Welcome to Tek-Tips![/blue]

To get great answers be sure to have a serious look at FAQ219-2884 or FAQ181-2886

Calvin.gif
See Ya! . . . . . .
 
TheAceMan1

[blue]"WHERE (tblUsers.UserID='" & [CurrentUser] & ")'"[/blue]

"WHERE (tblUsers.UserID='" & [CurrentUser] & "[red]')[/red]"

Ultra fast typing...[wink]
 
JerryKlmns . . .

[blue]Good Eye![/blue] [thumbsup2] . . . Don't know how I missed it! . . .

[blue]10doesch![/blue] . . . corrected code:
Code:
[blue]   Dim SQL As String
   
   SQL = "SELECT tblUsers.MgrID, A.SourcingMgrLast " & _
         "FROM tblSourcingManagers AS A " & _
         "INNER JOIN tblUsers " & _
         "ON A.SourcingMgrID = tblUsers.SourcingMgrID " & _
         "WHERE (tblUsers.UserID='" & [CurrentUser] & "[red][b]')[/b][/red]"
   Set rst = CurrentProject.Connection.Execute(SQL)[/blue]

Calvin.gif
See Ya! . . . . . .
 
Thanks - but what is happening to cause error
"No value given for one or more required parameters?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top