Access Project - Passing Guid to stored procedure



Hi to you all,

I need to pass a GUID to a stored procedure. The value I want to pass is
the value of a text box in a subform (see Form.Subform1.Form.setid.Value)
When I execute the following code, I get an error "Invalid character value
for cast specification".

Can't figure this out.
Any help appreciated !

Dim cn As ADODB.Connection
Dim cmd As ADODB.Command '

Set cn = CurrentProject.Connection
Set cmd = New ADODB.Command
With cmd
.ActiveConnection = cn
.CommandText = "sp_GetSetRunID"
.CommandType = adCmdStoredProc
.Parameters("@mSetID").Value = Form.Subform1.Form.setid.Value
End With

Set cmd = Nothing
Set cn = Nothing

Alex Dybenko

you can try to enclose value in single quotes:

..Parameters("@mSetID").Value = "'" & Form.Subform1.Form.setid.Value & "'"

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question