I am trying to call an oracle function via MS Access with three parameters. I am getting an error. VM_Delete_Chem is not a procedure or undefined. How do I call this as a Function to return an integer. Please help!! Thanks you!!
Code:
Dim db As Database
Dim qryOracleProc As QueryDef
Dim strSQL, strDeleteHeat, strDeleteSampleid, strSearchError As String
Dim strDeleteDateSample As Date
Dim varUpdateScriptMsg As Variant
strDeleteHeat = Me.txtSaveOldHeat.Value
strDeleteSampleid = Me.txtSaveOldSampleid.Value
strDeleteDateSample = Format(Me.TxtSampleDate.Value, "mm/dd/yyyy hh:mm:ss AMPM")
Set db = CurrentDb()
Set qryOracleProc = db.CreateQueryDef("")
'SQL to call stored procedure VM_Delete_Chem with the following parameters
'Call with Heat number
' Sample ID
' Sample date and Time YYYY-MM-DD-HH-MM-SS
'Returns: 0 - successful
' 1 - no records found procedure failed
' 2 - multi records found procedure failed
' 3 - Other exception procedure failed
strSQL = "BEGIN VMSTAR.VM_DELETE_CHEM("
strSQL = strSQL & "'" & strDeleteHeat & "', "
strSQL = strSQL & "'" & strDeleteSampleid & "', "
strSQL = strSQL & "to_date('" & strDeleteDateSample & "','mm/dd/yyyy HH:Mi:SS PM'))"
strSQL = strSQL & "; END;"
'ODBC connection
qryOracleProc.Connect="ODBC;DSN=pamioh;UID=chemxx;PWD=xxxx;SERVER=pamioh"
qryOracleProc.SQL = strSQL
qryOracleProc.ReturnsRecords = False
qryOracleProc.ODBCTimeout = 60
qryOracleProc.Execute
Set qryOracleProc = Nothing
Code:
Dim db As Database
Dim qryOracleProc As QueryDef
Dim strSQL, strDeleteHeat, strDeleteSampleid, strSearchError As String
Dim strDeleteDateSample As Date
Dim varUpdateScriptMsg As Variant
strDeleteHeat = Me.txtSaveOldHeat.Value
strDeleteSampleid = Me.txtSaveOldSampleid.Value
strDeleteDateSample = Format(Me.TxtSampleDate.Value, "mm/dd/yyyy hh:mm:ss AMPM")
Set db = CurrentDb()
Set qryOracleProc = db.CreateQueryDef("")
'SQL to call stored procedure VM_Delete_Chem with the following parameters
'Call with Heat number
' Sample ID
' Sample date and Time YYYY-MM-DD-HH-MM-SS
'Returns: 0 - successful
' 1 - no records found procedure failed
' 2 - multi records found procedure failed
' 3 - Other exception procedure failed
strSQL = "BEGIN VMSTAR.VM_DELETE_CHEM("
strSQL = strSQL & "'" & strDeleteHeat & "', "
strSQL = strSQL & "'" & strDeleteSampleid & "', "
strSQL = strSQL & "to_date('" & strDeleteDateSample & "','mm/dd/yyyy HH:Mi:SS PM'))"
strSQL = strSQL & "; END;"
'ODBC connection
qryOracleProc.Connect="ODBC;DSN=pamioh;UID=chemxx;PWD=xxxx;SERVER=pamioh"
qryOracleProc.SQL = strSQL
qryOracleProc.ReturnsRecords = False
qryOracleProc.ODBCTimeout = 60
qryOracleProc.Execute
Set qryOracleProc = Nothing