Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() I have the following code that retieve data from an access query but since the access query has a parameter call id it is complaning that I do not pass the value of the parameter. (SELECT Table1.version, Table1.id, * FROM Table1 WHERE (((Table1.id)=[ id ])) ORDER BY Table1.version DESC;) How do I Add to the below the value for my parameter id? Dim Connection As ADODB.Connection Set Connection = New ADODB.Connection Connection.ConnectionString = ConnectionString Connection.Open Dim Recordset As Recordset Dim RowsAffected As Long Dim i As Integer Dim Cmd As Object Set Recordset = Connection.Execute("[Query1]", RowsAffected, CommandTypeEnum.adCmdTable) Thanks, Mark |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If you know the SQL why not just query it in excel instead of running access
query? "mark" wrote: I have the following code that retieve data from an access query but since the access query has a parameter call id it is complaning that I do not pass the value of the parameter. (SELECT Table1.version, Table1.id, * FROM Table1 WHERE (((Table1.id)=[ id ])) ORDER BY Table1.version DESC;) How do I Add to the below the value for my parameter id? Dim Connection As ADODB.Connection Set Connection = New ADODB.Connection Connection.ConnectionString = ConnectionString Connection.Open Dim Recordset As Recordset Dim RowsAffected As Long Dim i As Integer Dim Cmd As Object Set Recordset = Connection.Execute("[Query1]", RowsAffected, CommandTypeEnum.adCmdTable) Thanks, Mark |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Because there are a lot of stored procedures and I do not want to have to
rewrite them all. "Mike" wrote: If you know the SQL why not just query it in excel instead of running access query? "mark" wrote: I have the following code that retieve data from an access query but since the access query has a parameter call id it is complaning that I do not pass the value of the parameter. (SELECT Table1.version, Table1.id, * FROM Table1 WHERE (((Table1.id)=[ id ])) ORDER BY Table1.version DESC;) How do I Add to the below the value for my parameter id? Dim Connection As ADODB.Connection Set Connection = New ADODB.Connection Connection.ConnectionString = ConnectionString Connection.Open Dim Recordset As Recordset Dim RowsAffected As Long Dim i As Integer Dim Cmd As Object Set Recordset = Connection.Execute("[Query1]", RowsAffected, CommandTypeEnum.adCmdTable) Thanks, Mark |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Mark
You cannot pass parameters in Access via ODBC and MSQuery...try putting the parameters in Excel (Paste url on one line) http://www.nickhodge.co.uk/gui/datam...C_Data_Queries -- HTH Nick Hodge Microsoft MVP - Excel Southampton, England DTHIS web: www.nickhodge.co.uk blog (non-tech): www.nickhodge.co.uk/blog/ "mark" wrote in message ... I have the following code that retieve data from an access query but since the access query has a parameter call id it is complaning that I do not pass the value of the parameter. (SELECT Table1.version, Table1.id, * FROM Table1 WHERE (((Table1.id)=[ id ])) ORDER BY Table1.version DESC;) How do I Add to the below the value for my parameter id? Dim Connection As ADODB.Connection Set Connection = New ADODB.Connection Connection.ConnectionString = ConnectionString Connection.Open Dim Recordset As Recordset Dim RowsAffected As Long Dim i As Integer Dim Cmd As Object Set Recordset = Connection.Execute("[Query1]", RowsAffected, CommandTypeEnum.adCmdTable) Thanks, Mark |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
pass parameter to access query | Links and Linking in Excel | |||
Pass date parameter into MS Query | Excel Discussion (Misc queries) | |||
Is it possible to pass a parameter into IN operator in Query? | Excel Discussion (Misc queries) | |||
How to pass a workshhet name as a parameter into a subroutine ? | Excel Discussion (Misc queries) | |||
Pass Parameter to Access Query | Excel Programming |