VB Code:
Dim objCmd As ADODB.Command
Call EstablishConnection
Set objCmd = New ADODB.Command
objConn.CursorLocation = adUseClient
With objCmd
.ActiveConnection = objConn
.CommandText = "your_sproc_name" 'our stored procedure
.CommandType = adCmdStoredProc 'its a stored procedure
Set objRS = .Execute
Set objRS.ActiveConnection = Nothing
Call ReleaseConnection
End With
If objRS.BOF Then
'no records?
MsgBox "Your search returned no results!", vbExclamation, "Record Not Found!"
Else
If objRS.EOF Then
MsgBox "Your search returned no results!", vbExclamation, "Record Not Found!"
Unload frmMain
Else
While Not objRS.EOF
Value = objRS.Fields("PartName")
If Value = partname Then
dbAdd = False
End If
objRS.movenext
End If
End If
Done:
Set objCmd = Nothing
Exit Sub
Err_Handler:
MsgBox Err.Description, vbCritical, "Error #: " & Err.Number
Resume Done