ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Cell value for Query (https://www.excelbanter.com/excel-programming/370022-cell-value-query.html)

CLR

Cell value for Query
 
Hi All......
I have a line of code used to run a MSQuery. It works fine as is, but I
would like to extract the hard coded 165167 and instead obtain it from a cell
value or preferably from an InputBox............
Here's the code snippet......

& Chr(10) & "WHERE (WO.WONUM='165167')" _

Any help would be much appreciated........

Vaya con Dios,
Chuck, CABGx3



Tom Ogilvy

Cell value for Query
 
& Chr(10) & "WHERE (WO.WONUM='" & Range("A1").Value & "')" _

would be one way. Range("A1") can be replace with inputbox.

There is also a parameter query option with a query table. This is part of
the definition of query, so it can pop up its own box or get the value from a
cell.

See these links for that possibility

http://nickhodge.co.uk/gui/datamenu/...taexamples.htm

http://www.dicks-clicks.com/excel/Ex...htm#Parameters

--
Regards,
Tom Ogilvy



"CLR" wrote:

Hi All......
I have a line of code used to run a MSQuery. It works fine as is, but I
would like to extract the hard coded 165167 and instead obtain it from a cell
value or preferably from an InputBox............
Here's the code snippet......

& Chr(10) & "WHERE (WO.WONUM='165167')" _

Any help would be much appreciated........

Vaya con Dios,
Chuck, CABGx3



CLR

Cell value for Query
 
Thanking you very much, kind Sir, worked like a charm...............it's good
to see you!

Vaya con Dios,
Chuck, CABGx3



"Tom Ogilvy" wrote:

& Chr(10) & "WHERE (WO.WONUM='" & Range("A1").Value & "')" _

would be one way. Range("A1") can be replace with inputbox.

There is also a parameter query option with a query table. This is part of
the definition of query, so it can pop up its own box or get the value from a
cell.

See these links for that possibility

http://nickhodge.co.uk/gui/datamenu/...taexamples.htm

http://www.dicks-clicks.com/excel/Ex...htm#Parameters

--
Regards,
Tom Ogilvy



"CLR" wrote:

Hi All......
I have a line of code used to run a MSQuery. It works fine as is, but I
would like to extract the hard coded 165167 and instead obtain it from a cell
value or preferably from an InputBox............
Here's the code snippet......

& Chr(10) & "WHERE (WO.WONUM='165167')" _

Any help would be much appreciated........

Vaya con Dios,
Chuck, CABGx3




All times are GMT +1. The time now is 09:04 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com