Running a query based off values in col A

  • Thread starter Thread starter sjones
  • Start date Start date
S

sjones

I have a macro that pulls data from an extranal websit.

The values return look like this

861
913
315
407
570

These are area code

Based off the value I need to query our database via ODBC
Select Count(*) from Table where Telephone is like value in A1
Select Count(*) from Table where Telephone is like value in A2
Select Count(*) from Table where Telephone is like value in A3
Select Count(*) from Table where Telephone is like value in A4
etc

I only need to see the count return to Column B

Any ideas on how to proceed

Thanks
Steve
 
...
Based off the value I need to query our database via ODBC
Select Count(*) from Table where Telephone is like value in A1
Select Count(*) from Table where Telephone is like value in A2
Select Count(*) from Table where Telephone is like value in A3
Select Count(*) from Table where Telephone is like value in A4
etc

I only need to see the count return to Column B

Any ideas on how to proceed

Some ideas:

SQL.REQUEST if you like ready-tolled worksheet formulas and many round
trips to the database isn't an issue (the formula can point to the
value in the cells).

MS Query if you prefer a GUI data access tool (the cell values can be
passed as parameters).

ADO if you like VBA code (you can do just about anything you like with
VBA!)

Jamie.

--
 

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