Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Using InputBox to change query criteria in Access

So I'm trying to use the value from the inpubox, called
INDCODE here, to change the criteria for an external data
pull from Access. INDCODE is recongnized [in WHERE
(`Invoice Summary Query`.EXPENSE_INDEX_CODE=INDCODE)] as
the I can put my cursor on it after that step and see that
the value takes, but I get a general ODBC error on the
last step - .Refresh BackgroundQuery:=False

Help and thx in advance!

Message = "Please input the index code"
Title = "ICI report generator"
INDCODE = InputBox(Message, Title, "", 5250, 5250)
With ActiveSheet.QueryTables.Add(Connection:=Array
(Array( _
"ODBC;DSN=MS Access Database;DBQ=C:\Documents and
Settings\jboy\Desktop\ICIREPORTING.mdb;DefaultDir= C:\Docume
nts and Settings\jboy" _
), Array("e\Desktop;DriverId=25;FIL=MS
Access;MaxBufferSize=2048;PageTimeout=5;" _
)), Destination:=Range("A2"))
.CommandText = Array( _
"SELECT `Invoice Summary Query`.BILLING_DATE,
`Invoice Summary Query`.SERVICE_NAME, `Invoice Summary
Query`.DESCRIPTION, `Invoice Summary
Query`.REQUESTOR_FIRST_NAME, `Invoice Summary
Query`.REQUESTOR_LAST_NAME, `Invoice Summary Qu" _
, _
"ery`.AUTHORIZER_FIRST_NAME, `Invoice Summary
Query`.AUTHORIZER_LAST_NAME, `Invoice Summary
Query`.EXPENSE_JE_NUMBER, `Invoice Summary
Query`.EXPENSE_JE_SUFFIX, `Invoice Summary
Query`.REVENUE_JE_NUMBER, `Invoice Summary Query`.REV" _
, _
"ENUE_JE_SUFFIX, `Invoice Summary
Query`.EXPENSE_SUBOBJECT_CODE, `Invoice Summary
Query`.AMOUNT_BILLED, `Invoice Summary
Query`.EXPENSE_INDEX_CODE FROM `C:\Documents and
Settings\jboy\Desktop\ICIREPORTING`.`Invoice Summary
Query" _
, _
"` `Invoice Summary Query` WHERE (`Invoice
Summary Query`.EXPENSE_INDEX_CODE=INDCODE) ORDER BY
`Invoice Summary Query`.BILLING_DATE, `Invoice Summary
Query`.EXPENSE_SUBOBJECT_CODE, `Invoice Summary
Query`.AMOUNT_BILLED" _
)
.Name = "Copy of ICI billing from Access_1"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = True
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.SourceConnectionFile = _
"C:\Documents and Settings\jboy\Application
Data\Microsoft\Queries\Copy of ICI billing from Access.dqy"
.Refresh BackgroundQuery:=False
End With
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Using InputBox to change query criteria in Access

Hi,



InputBox return a string and it seem that you need a number.






--
JP

http://www.solutionsvba.com


"JohnBoy" wrote in message
...
So I'm trying to use the value from the inpubox, called
INDCODE here, to change the criteria for an external data
pull from Access. INDCODE is recongnized [in WHERE
(`Invoice Summary Query`.EXPENSE_INDEX_CODE=INDCODE)] as
the I can put my cursor on it after that step and see that
the value takes, but I get a general ODBC error on the
last step - .Refresh BackgroundQuery:=False

Help and thx in advance!

Message = "Please input the index code"
Title = "ICI report generator"
INDCODE = InputBox(Message, Title, "", 5250, 5250)
With ActiveSheet.QueryTables.Add(Connection:=Array
(Array( _
"ODBC;DSN=MS Access Database;DBQ=C:\Documents and
Settings\jboy\Desktop\ICIREPORTING.mdb;DefaultDir= C:\Docume
nts and Settings\jboy" _
), Array("e\Desktop;DriverId=25;FIL=MS
Access;MaxBufferSize=2048;PageTimeout=5;" _
)), Destination:=Range("A2"))
.CommandText = Array( _
"SELECT `Invoice Summary Query`.BILLING_DATE,
`Invoice Summary Query`.SERVICE_NAME, `Invoice Summary
Query`.DESCRIPTION, `Invoice Summary
Query`.REQUESTOR_FIRST_NAME, `Invoice Summary
Query`.REQUESTOR_LAST_NAME, `Invoice Summary Qu" _
, _
"ery`.AUTHORIZER_FIRST_NAME, `Invoice Summary
Query`.AUTHORIZER_LAST_NAME, `Invoice Summary
Query`.EXPENSE_JE_NUMBER, `Invoice Summary
Query`.EXPENSE_JE_SUFFIX, `Invoice Summary
Query`.REVENUE_JE_NUMBER, `Invoice Summary Query`.REV" _
, _
"ENUE_JE_SUFFIX, `Invoice Summary
Query`.EXPENSE_SUBOBJECT_CODE, `Invoice Summary
Query`.AMOUNT_BILLED, `Invoice Summary
Query`.EXPENSE_INDEX_CODE FROM `C:\Documents and
Settings\jboy\Desktop\ICIREPORTING`.`Invoice Summary
Query" _
, _
"` `Invoice Summary Query` WHERE (`Invoice
Summary Query`.EXPENSE_INDEX_CODE=INDCODE) ORDER BY
`Invoice Summary Query`.BILLING_DATE, `Invoice Summary
Query`.EXPENSE_SUBOBJECT_CODE, `Invoice Summary
Query`.AMOUNT_BILLED" _
)
.Name = "Copy of ICI billing from Access_1"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = True
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.SourceConnectionFile = _
"C:\Documents and Settings\jboy\Application
Data\Microsoft\Queries\Copy of ICI billing from Access.dqy"
.Refresh BackgroundQuery:=False
End With



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Using InputBox to change query criteria in Access

Inputbox is a string and works fine when hardcoded, though.
-----Original Message-----
Hi,



InputBox return a string and it seem that you need a

number.






--
JP

http://www.solutionsvba.com


"JohnBoy" wrote in message
...
So I'm trying to use the value from the inpubox, called
INDCODE here, to change the criteria for an external

data
pull from Access. INDCODE is recongnized [in WHERE
(`Invoice Summary Query`.EXPENSE_INDEX_CODE=INDCODE)] as
the I can put my cursor on it after that step and see

that
the value takes, but I get a general ODBC error on the
last step - .Refresh BackgroundQuery:=False

Help and thx in advance!

Message = "Please input the index code"
Title = "ICI report generator"
INDCODE = InputBox(Message, Title, "", 5250, 5250)
With ActiveSheet.QueryTables.Add(Connection:=Array
(Array( _
"ODBC;DSN=MS Access Database;DBQ=C:\Documents

and

Settings\jboy\Desktop\ICIREPORTING.mdb;DefaultDir= C:\Docume
nts and Settings\jboy" _
), Array("e\Desktop;DriverId=25;FIL=MS
Access;MaxBufferSize=2048;PageTimeout=5;" _
)), Destination:=Range("A2"))
.CommandText = Array( _
"SELECT `Invoice Summary Query`.BILLING_DATE,
`Invoice Summary Query`.SERVICE_NAME, `Invoice Summary
Query`.DESCRIPTION, `Invoice Summary
Query`.REQUESTOR_FIRST_NAME, `Invoice Summary
Query`.REQUESTOR_LAST_NAME, `Invoice Summary Qu" _
, _
"ery`.AUTHORIZER_FIRST_NAME, `Invoice Summary
Query`.AUTHORIZER_LAST_NAME, `Invoice Summary
Query`.EXPENSE_JE_NUMBER, `Invoice Summary
Query`.EXPENSE_JE_SUFFIX, `Invoice Summary
Query`.REVENUE_JE_NUMBER, `Invoice Summary Query`.REV" _
, _
"ENUE_JE_SUFFIX, `Invoice Summary
Query`.EXPENSE_SUBOBJECT_CODE, `Invoice Summary
Query`.AMOUNT_BILLED, `Invoice Summary
Query`.EXPENSE_INDEX_CODE FROM `C:\Documents and
Settings\jboy\Desktop\ICIREPORTING`.`Invoice Summary
Query" _
, _
"` `Invoice Summary Query` WHERE (`Invoice
Summary Query`.EXPENSE_INDEX_CODE=INDCODE) ORDER BY
`Invoice Summary Query`.BILLING_DATE, `Invoice Summary
Query`.EXPENSE_SUBOBJECT_CODE, `Invoice Summary
Query`.AMOUNT_BILLED" _
)
.Name = "Copy of ICI billing from Access_1"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = True
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.SourceConnectionFile = _
"C:\Documents and Settings\jboy\Application
Data\Microsoft\Queries\Copy of ICI billing from

Access.dqy"
.Refresh BackgroundQuery:=False
End With



.

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
Query from Access into Excel cause Access to go to read only T Stephens Excel Discussion (Misc queries) 0 March 24th 09 04:17 PM
Applying Criteria in Excel Cell to MS Query Pull from Access Tony Excel Discussion (Misc queries) 1 February 1st 08 04:43 PM
Can I use MS Query in Excel like an Append Query in Access Sam Wardill Excel Discussion (Misc queries) 0 April 11th 06 02:41 PM
Microsoft Query rejects "nz" function in Access Query Vaughan Excel Discussion (Misc queries) 0 May 4th 05 05:20 PM
How to use a Access Query that as a parameter into Excel database query Karen Middleton Excel Discussion (Misc queries) 1 December 13th 04 07:54 PM


All times are GMT +1. The time now is 01:43 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"