Creating Input box that grap data based on user answer

S

salooha

Hi there,

I have a macro that get data from an ODBC connection and dump into a
spreadsheet, the sql code get the data based on the login ID that I
have to manually enter into the vba code.

is there a way to create an inputbox in excel that pass this login ID
as a parameter to the sql code and then get the data based on what the
user enter into the input box?


Code:
--------------------


With ActiveSheet.QueryTables.Add(Connection:= _
"ODBC;DSN=datasource
dbo.users.ID where users.login = 'userID'
End With

--------------------



thanks in advance for your help..
 
T

tony h

Environ("username") should give you the user's name without having to
enter it. It is normally specified as USR="myname"

regards
 

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