VBA Excel Workbook with Database connection to SQL server need login information

I have an Excel VBA workbook that I have created. It has a control panel page with a button installed to run the VB/ASP script that runs against our SQL Database. I have created text boxes for entry for dates and have used these as input for the VB/ASP script that pulls the individual sheets(Reports). Now, I want to declare the username from ENVIRON ("UserName") then evaluate the username against a list of usernames and return the user_id (aka UserNumber) to the text box on the control panel page (user_id in sql database). Example: if sjones is logged into windows then evaluate list of Usernames=165?, then Var1 = Var1 & "OR ( pd.created_by = '" + Sheets("Control Panel").UserNumber.Text + "' ) ) " & vbCrLf

I want to pull reports based on the person logged into Windows at the time to keep others from running the report for anyone but themselves. The worksheet location is open to all users but I want them to only run the reports for the user logged in? There is probably an easier way to do this but I am very weak in VB/ASP. Please help. TIA Conya


Get username first and execute a sql query to get a userID associated with that. The code might looks like:

Public UName, UID as String 

Public Sub GetUName()
    UName = Environ("USERNAME") 
End Sub

Public Sub GetUID()
    strSQL = "Select UID from table1 where username=" & "'" UName & "'"
    UID = oConn.Execute strSQL
End Sub

Need Your Help

RSpec, Capybara, and Selenium with Rails 4

selenium ruby-on-rails-4 capybara rspec-rails

I have upgraded my application from Rails 3.2 to Rails 4. I am using RSpec, Capybara, and selenium-webdriver.

Determine nearest mirror PHP

php geolocation ip-address mirroring proximity

I maintain a site with a bunch of downloadable files. It is currently hosted on a server in the U.S., but I have recently acquired a new server in Germany. I would like to mirror the downloads to the