[RESOLVED]create a prompt in Excel and run a sql server query
hi,
I usually run a query against sql server by going to Get external Data --> run database query.
can someone instruct me to how I can embbed a prompt in excel so when someone opens the excel spreadsheet they would get the prompts with paramters that they want to pass to the query?
the prompts must be a dropdown list populated from query then the final step is running last query with the three parameters they selected.
Re: create a prompt in Excel and run a sql server query
thanks Static. how can I prepopulate three drop down list with these values? it would nice to dynamic but it doesn't have to. so three dropdown list with my values and after selecting then the parameters will be passed to my query.
Re: create a prompt in Excel and run a sql server query
actually i got the connection from that site. my problem is that connection or recordset objects are not recognized. am I missing a library or a referance?
Re: create a prompt in Excel and run a sql server query
Static -- hope you had a good lunch.
I get this error : Run-Time '3265' : application-defined or object defined error
-------------------------
Do While Not rs.EOF
Sheet1.OLEObjects("cbox1").AddItem rs!ID ----> ERROR LINE
' OR Sheet1.OLEObjects.cbox1.AddItem rs!ID --still same error
Re: create a prompt in Excel and run a sql server query
thank you static is works now on my mdb but when I switched the connection to sql server I got this error: Automation error upspecified error
on this line
CNN.Open "Driver={SQL Server};Server=serverName;Database=dbname;Uid=user;Pwd=pass;"
do you know what might be the issue.
thanks for your help.
waely
Re: create a prompt in Excel and run a sql server query
sure do
look at that line:
Is the Server really called "ServerName"??
is the database on the server called "dbname"??
user?
pass?
you need to change each of the values (in bold) to suit your needs
Re: create a prompt in Excel and run a sql server query
Originally Posted by Static
sure do
look at that line:
Is the Server really called "ServerName"??
is the database on the server called "dbname"??
user?
pass?
you need to change each of the values (in bold) to suit your needs