?
Solved

MS Access data from Stored Procedure

Posted on 2012-09-19
5
Medium Priority
?
409 Views
Last Modified: 2012-09-24
I have a button that on click I want to execute a stored procedure and then set a variable )strEnc) to the returned value of the column name (encContactID)

Been in .Net for a while and sp can't see where I set the variable from this

    Set cmd.ActiveConnection = Conn
    cmd.CommandType = adCmdStoredProc
    cmd.CommandText = "[usp_EncryptClientContactID]"
    cmd.Parameters("@ContactID") = Me.[Contact ID]
    cmd.Execute
0
Comment
Question by:lrbrister
  • 3
  • 2
5 Comments
 
LVL 29

Expert Comment

by:Paul Jackson
ID: 38414485
How are you returning the value in the stored procedure ? Output parameter, return value?
0
 

Author Comment

by:lrbrister
ID: 38414520
Just returning a value

Also...watch for additional question
0
 
LVL 29

Expert Comment

by:Paul Jackson
ID: 38414744
PLease post your Stored Procedure, I know you are returning a value I need to understand what method you are using to return the value if you are at all
0
 

Accepted Solution

by:
lrbrister earned 0 total points
ID: 38415023
Found my own answer
        Dim strMailTo As String
        Dim cid As String
        Dim cmd As New ADODB.Command
        Dim retSet As ADODB.Recordset
       
        Set cmd.ActiveConnection = Conn
        cmd.CommandType = adCmdStoredProc
        cmd.CommandText = "[usp_EncryptString]"
        cmd.Parameters("@string") = "id:" & Me.[Contact ID] & "|type:ClientContact"
        Set retSet = cmd.Execute
        If Not retSet.EOF Then
            cid = retSet![encContactID]
        End If
0
 

Author Closing Comment

by:lrbrister
ID: 38427995
Found my own answer
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft's Excel has many features that most people will never need nor take advantage of.  Conditional formatting is one feature that you may find a necessity once you start using it.
In a use case, a user needs to close an opened report by simply pressing the Escape (Esc) key. This can be done by adding macro code in Report_KeyPress or Report_KeyDown event.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question