access 2003 mdb with sql passthrough query against sql server 2000

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
 
J

janetb

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
 
C

colette labonte

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top