Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 138
Default Pass Combo Values to an ODBC Parameter........

Is this possible???????

I have an ODBC report which I currently refresh with values passed from a
comebobox on s form to a cell on a worksheet from which the ODBC parameters
refresh the ODBC data on a second worksheet.

What I want to do is remove the need to have worksheets to store combobox
values to refresh an ODBC I want to pass the values direct thus removing the
need to have unecessary worksheets and speed up the report data refreshing -
does that make sense & is it relativly easy?

Tia


Jonathan
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default Pass Combo Values to an ODBC Parameter........

Possible and not terribly difficult.
Sample code below - with any needed substitutions could be put in the
ComboBox1_Change event procedu
With Worksheets("Sheet1").QueryTables(1)
.Parameters(1).SetParam xlConstant, ComboBox1.Value
.Refresh
End With
--
- K Dales


"Jonathan" wrote:

Is this possible???????

I have an ODBC report which I currently refresh with values passed from a
comebobox on s form to a cell on a worksheet from which the ODBC parameters
refresh the ODBC data on a second worksheet.

What I want to do is remove the need to have worksheets to store combobox
values to refresh an ODBC I want to pass the values direct thus removing the
need to have unecessary worksheets and speed up the report data refreshing -
does that make sense & is it relativly easy?

Tia


Jonathan

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 138
Default Pass Combo Values to an ODBC Parameter........

Thanks I'll give this a try, can I be cheeky and ask one more question?

In my ComboBox I have user friendly Options i.e. "Birmingham", "Manchester",
"Leeds" etc however I want to return the values from the user selection to be
"Manx", "LDS", etc how do I do this?

"K Dales" wrote:

Possible and not terribly difficult.
Sample code below - with any needed substitutions could be put in the
ComboBox1_Change event procedu
With Worksheets("Sheet1").QueryTables(1)
.Parameters(1).SetParam xlConstant, ComboBox1.Value
.Refresh
End With
--
- K Dales


"Jonathan" wrote:

Is this possible???????

I have an ODBC report which I currently refresh with values passed from a
comebobox on s form to a cell on a worksheet from which the ODBC parameters
refresh the ODBC data on a second worksheet.

What I want to do is remove the need to have worksheets to store combobox
values to refresh an ODBC I want to pass the values direct thus removing the
need to have unecessary worksheets and speed up the report data refreshing -
does that make sense & is it relativly easy?

Tia


Jonathan

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default Pass Combo Values to an ODBC Parameter........

Probably the easiest way: make the combobox into a 2 column combobox
(ColumnCount = 2), putting the full name in one column and the abbreviation
in the other. You can hide the abbreviation column by setting its width to 0
if you don't want the user to have to see it. Let's say you have the
abbreviation in the first column (Column(0) in VBA code) and the name in the
other column. Then the code would look like this:

With Worksheets("Sheet1").QueryTables(1)
.Parameters(1).SetParam xlConstant, ComboBox1.Column(0)
.Refresh
End With

--
- K Dales


"Jonathan" wrote:

Thanks I'll give this a try, can I be cheeky and ask one more question?

In my ComboBox I have user friendly Options i.e. "Birmingham", "Manchester",
"Leeds" etc however I want to return the values from the user selection to be
"Manx", "LDS", etc how do I do this?

"K Dales" wrote:

Possible and not terribly difficult.
Sample code below - with any needed substitutions could be put in the
ComboBox1_Change event procedu
With Worksheets("Sheet1").QueryTables(1)
.Parameters(1).SetParam xlConstant, ComboBox1.Value
.Refresh
End With
--
- K Dales


"Jonathan" wrote:

Is this possible???????

I have an ODBC report which I currently refresh with values passed from a
comebobox on s form to a cell on a worksheet from which the ODBC parameters
refresh the ODBC data on a second worksheet.

What I want to do is remove the need to have worksheets to store combobox
values to refresh an ODBC I want to pass the values direct thus removing the
need to have unecessary worksheets and speed up the report data refreshing -
does that make sense & is it relativly easy?

Tia


Jonathan

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
pass parameter to access query Bill Manville Links and Linking in Excel 4 May 1st 23 03:45 AM
Pass date parameter into MS Query Richard Edwards Excel Discussion (Misc queries) 2 June 20th 08 11:43 AM
Is it possible to pass a parameter into IN operator in Query? DennisS Excel Discussion (Misc queries) 0 June 26th 07 09:27 AM
Pass worksheet to macro as a parameter Przemek Excel Programming 1 July 12th 05 05:50 PM
Pass parameter to a form and then open it? Darren Hill[_2_] Excel Programming 3 February 7th 04 06:21 PM


All times are GMT +1. The time now is 02:51 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"