can I use some Qwery to populate the sheet with the data from pre.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Can I populate the sheet with the data from a different sheet of the book
based on the value of the data on the sheet from one of the columns.
Something like
INsert into .....
select * from ....
where ....
 
If i understand your question, what you're looking to do is build
query based on cell input?

If you were looking for the query "Select mycolumn from mytable wher
mycolumn like = mystring" where all the "my" variables are taken fro
cell input you could do the following.

Dim mycolumn, mytable, mycondition As String
Dim querystring As String

mycolumn = [Sheet1!A1] <--- lets say the cell contains "age"
mytable = [Sheet1!A2] <---- lets say the cell contains "family"
mycondition = [Sheet1!A3] <---- lets say the cell contains "85"

querystring = "Select " & mycolumn & " from " & mytable & " where "
mycolum & " like " & mycondition

You'd then get querystring as "Select age from family where age lik
85". So all you need to do is just pass the querystring string t
whatever mechanism performs your query. Of course you can get muc
creative than in taking the user's input but that gives you a basi
idea of how to do it using cells for input
 

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

Back
Top