ms-access


Pass Parameter to Stored Procedure


The Following code returns a stored procedure with a hard value coded. I need to allow 74(#catcode in Stored Procedure) to change to whatever is selected from a combo box. Any help is greatly appreciated. I am using a pass through query in Access.
Private Sub ok_Click()
Dim objConnection As New ADODB.Connection
Dim objCom As ADODB.Command
Dim provStr As String
Dim objConnection As New ADODB.Connection
Dim objCom As ADODB.Command
Dim provStr As String
Set objCom = New ADODB.Command
objConnection.Provider = "sqloledb"
provStr = "Data Source=***;" & "Initial Catalog=***;User Id=***;Password=***;"
objConnection.Open provStr
With objCom
.ActiveConnection = objConnection
.CommandText = "dbo.ix_spc_planogram_match " & ("#catcode=") & Me.cat_code.Value
.CommandType = adCmdStoredProc
.Parameters.Refresh
.Parameters("#catcode").Value = me.cat_code.value
.Execute
End With
End Sub
Stored Procedure:
execute dbo.ix_spc_planogram_match #catcode
I imagine that you mean something on these lines:
.CommandText = "dbo.ix_spc_planogram_match " & me.cat_code
.CommandType = adCmdStoredProc
.cmd.Parameters("#catcode") = me.cat_code
.Execute
This is assuming that the bound column of the combo contains the required value.

Related Links

Id field (primary key) is skipping numbers of rows that have been deleted, how to change?
Create a Schedule task that run a access file
Does Access 2013 still have an ACE database or equivalent?
Creating 2D (Data Matrix or QR Codes) in MS Access Reports/Forms
Mass Delete Individual Fields
Error on INSERT statement
Microsoft Access 2003 - Expression Builder
Reference existing expression
Automatically updated the textbox
Profiler for MSAccess
Access Switchboard Manager: Invalid Procedure Call or Argument
how should this SQL be written?
Data type for currency values in Access
Update top rows in Access table that match condition
Data type in access 2007
How to specify a custom format for a text pattern in Microsoft Access?

Categories

HOME
ms-access
twitter
multithreading
openlayers
osgi
keras
minimum-spanning-tree
relayjs
octobercms
contact
facebook-messenger-bot
gitpitch
vifm
dax
postgres-xl
timeout
size
foselasticabundle
seaborn
django-admin
transformation
pugjs
undefined
emulator
grails3
intentfilter
functional-testing
lcd
trading
semantic-analysis
filezilla
gsmcomm
instant-messaging
microsoft-chart-controls
bluestacks
airconsole
kendo-ui-grid
hybridauth
bower-install
appfabric
vapor
splice
quadratic-programming
estimote
fakeiteasy
no-www
vao
outlook-api
checkboxlist
node-sass
convertapi
google-datalayer
pnotify
dotnetzip
integrity
togetherjs
colorama
dtexec
r-forge
akka-cluster
memory-alignment
color-profile
xcb
heidisql
websitepanel
clang-static-analyzer
essence
design-by-contract
rtbkit
intel-fortran
c++03
kineticjs
network-interface
dealloc
picturefill
transcoding
farseer
batterylevel
qt-faststart
hosts-file
hgsubversion
hirefire
vdsp
cinema-4d
xtype
javax.script
gdlib
xsdobjectgen
forums
zend-tool
genealogy
misv

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App