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

How to include MS Access 2007 Runtime as a prerequisite to msi
MS Access user defined function in select sql
How do I use a variable in an input mask in Access?
Access application crashing on ME.[ControlOrFormName] on some machines
MS Access How can I show the query name in a report
Autofill parts description via parts number text box
Microsoft Access 03 right click diabled or (ShortCut menu = no)
How to open a second form based on info from first form?
Help with a form not showing data when moving from Access 2003 to Access 2010
Access 2010 - Need to replace a null with a value
Very slow subqueries when using “NOT IN”
Microsoft Access - Scrambling Totals
Selecting data from the start of every hour
MS Access Query - Use a parameter value as one of the selected records
How can I add a filter to my form based upon a joined table's columns that don't appear in the Select clause?
MS Access - Open database form from URL

Categories

HOME
pandas
winforms
openmp
webpack
single-sign-on
bpmn
binary-tree
primary-key
gnupg
google-cloud-spanner
vb.net-2010
task
try-catch
jsprit
pc
database-replication
jqwidget
text-rendering
intentfilter
facebook-instant-articles
zurb-foundation-6
one-to-many
fifo
elasticsearch-ruby
elasticsearch-net
buck
lightswitch-2013
sql-server-2012-express
ecto
karaf
mozilla
plsql-psp
main
libvpx
eclipse-scout
grid.mvc
botbuilder
unixodbc
businessworks
segment
babel-core
wso2carbon
qwt
termination
dds
dropbox-php
recursive-datastructures
nativeapplication
tactic
android-cursor
color-profile
account-kit
eventkit
pintos
root-framework
angular-strap
underscore.js-templating
mathematica-frontend
gstreamer-0.10
react-native-listview
moveit
essence
itextpdf
wapiti
associative-array
historian
ios8-today-widget
lib.web.mvc
lemon
eclipse-clp
comobject
qdialog
citrus-pay
oberon
web-controls
pick
google-style-guide
titanium-modules
dml
elliptic-curve
valueconverter
geos
gridfs
dbconnection
drools-planner
venn-diagram
newtonscript
labwindows
xmemcached
javax.script
subviews
gamequery
suppress
ugc

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