access 2003 mdb with sql passthrough query against sql server 2000

  • Thread starter Thread starter F. Mobile
  • Start date Start date
F

F. Mobile

Hi,

I created a sql passthroufh query in access 2003 with - select
user_name(user_id()).
I want to get the odbc sqlserver 2000 user on that client computer
That is running great.

Buit I need now the complete visual basic code for that.
The user opens an access 2003 main form and depending which odbc user he is
should form1 or form2 or.. be opened.


Windows ODBC Connection :dwh
User: u1
Pwd: p1
Db: db

Could somebody please show me the exact code for access 2003?

Thanks
 
What I did is created a user table on the sql server. I have a field
that stores domain\userlogin.

Set rs = CreateObject("ADODB.Recordset")
strFld = "EmployeeID"&","&"Acct"&","&"FullName"
strRS = "qryUser"
strSQL = "Select " & strFld &" From " & strRS

rs.Open strSQL, msodsc.Connection ,0,1

mAcct = rs.Fields("Acct").value
rs.close
set rs = nothing

My qryUser is a View in SQL that uses the criteria = SUSER_SNAME(), so
that query only returns one record for the user that is logged in to
the domain. In my example I have a field Acct that if a logical field.
It stored whether the user can do specific functions if Acct is true.

Hope this helps.
Janet
 
F. Mobile said:
Hi,

I created a sql passthroufh query in access 2003 with - select
user_name(user_id()).
I want to get the odbc sqlserver 2000 user on that client computer
That is running great.

Buit I need now the complete visual basic code for that.
The user opens an access 2003 main form and depending which odbc user he is
should form1 or form2 or.. be opened.


Windows ODBC Connection :dwh
User: u1
Pwd: p1
Db: db

Could somebody please show me the exact code for access 2003?

Thanks
 
Back
Top