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

Microsoft access is a mere file or data-base server
Is ACE/Jet's IN operator or CHECK constraint 'broken'?
Form.CurrentRecord=1 and Form.RecordSet.Absoluteposition=-1
email using Access and VBA without MAPI
MS Access Properties
Will Access support 35- 40 users writing to a Access database
Trying to limit input on a field
Sorting by month in MS Access
How to add a menu item to the default right click context menu
ASP Access Database web site on Windows 2008 Server running IIS 7
How to populate field descriptions in MS Access
Version control for VBA file
Mystery HAVING clause
MS Access 2003 - Sparkline Graphs in Microsoft Access
How to extract the schema of an Access (.mdb) database?
Using loop in a Access Query

Categories

HOME
blogger
netsuite
drivers
electron
android-4.4-kitkat
q
bookshelf.js
paw-app
jsrender
jgroups
ckeditor
baqend
installshield
acquia
datastax-java-driver
swagger-ui
qore
elasticsearch-hadoop
kibana-4
quickbooks
commonmark
ups
jsprit
workload-scheduler
database-replication
lldb
plunker
autoconf
dcevm
realex-payments-api
mmap
numerical-methods
kannel
pingfederate
kendo-datasource
delicious-api
bpel
airconsole
contact-form
catel
caret
mmenu
environment-modules
bower-install
bitbucket-pipelines
streamsets
reportbuilder
angularjs-factory
sql-server-agent
dynamic-reports
s
parentheses
termination
atomicity
jquery-validate
elgg
drupal-6
google-perftools
namecoin
pdfclown
jspdf-autotable
account-kit
crosswalk-runtime
abcpdf9
firmata
static-ip-address
deadbolt-2
spring-android
heidisql
phishing
merge-conflict-resolution
paypal-express
connect-by
testng-dataprovider
python-stackless
ipconfig
lib.web.mvc
wireshark-dissector
libressl
quicklisp
method-parameters
operation
createprocessasuser
iiviewdeckcontroller
dundas
dereference
facebook-graph-api-v2.4
asp.net-dynamic-data
article
comexception
ember-charts
prettify
blending
dataadapter
jelly
pvrtc
multipage
nsdatecomponents
gnustep
spyware
psi
horizontal-accordion
locationlistener
self-extracting
table-footer
forums
mtj
procedural-music
zune
django-notification
3gp

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