M
Michael Dekson
In this VB function I have "Run-time error '3151' and debug is located at
bold item (-->>).
If you know what I do wrong please help me to solve this problem.
Thanks
Public Function get_cjena_imp(p_vccid As Integer, p_datum As Date)
Dim RST As Recordset
Dim db As Database
Dim strSQL As String
If Not IsNull(p_vccid) And Not IsNull(p_datum) Then
Set db = CurrentDb
'strSQL = "SELECT P.CIJENA_IMPULSA FROM CRM_BIL_PARAMETRI AS P WHERE
P.VCC_ID= " & CStr(p_vccid) & " AND P.DATUM_OD=(SELECT MAX(P1.DATUM_OD) FROM
CRM_BIL_PARAMETRI P1 WHERE P1.VCC_ID = P.VCC_ID AND P1.DATUM_OD < " &
"cdate('" & CStr(p_datum) & "'));"
strSQL = "SELECT * FROM CRM_BIL_PARAMETRI"
'strSQL = "select * from stat"
-->> Set RST = db.OpenRecordset(strSQL, dbOpenDynaset, dbReadOnly)
If RST.EOF And RST.BOF Then
Exit Function
End If
get_cjena_imp = RST![CIJENA_IMPULSA]
'db.Properties!AppTitle = "KASA - OPERATER: " & RST![Prezime]
'Application.RefreshTitleBar
RST.Close
Set db = Nothing
'PASS_OK = True
DoCmd.Close
Else
MsgBox "Funkcija get_cjena_imp: jedan od parametara je prazan",
vbCritical
End If
End Function
bold item (-->>).
If you know what I do wrong please help me to solve this problem.
Thanks
Public Function get_cjena_imp(p_vccid As Integer, p_datum As Date)
Dim RST As Recordset
Dim db As Database
Dim strSQL As String
If Not IsNull(p_vccid) And Not IsNull(p_datum) Then
Set db = CurrentDb
'strSQL = "SELECT P.CIJENA_IMPULSA FROM CRM_BIL_PARAMETRI AS P WHERE
P.VCC_ID= " & CStr(p_vccid) & " AND P.DATUM_OD=(SELECT MAX(P1.DATUM_OD) FROM
CRM_BIL_PARAMETRI P1 WHERE P1.VCC_ID = P.VCC_ID AND P1.DATUM_OD < " &
"cdate('" & CStr(p_datum) & "'));"
strSQL = "SELECT * FROM CRM_BIL_PARAMETRI"
'strSQL = "select * from stat"
-->> Set RST = db.OpenRecordset(strSQL, dbOpenDynaset, dbReadOnly)
If RST.EOF And RST.BOF Then
Exit Function
End If
get_cjena_imp = RST![CIJENA_IMPULSA]
'db.Properties!AppTitle = "KASA - OPERATER: " & RST![Prezime]
'Application.RefreshTitleBar
RST.Close
Set db = Nothing
'PASS_OK = True
DoCmd.Close
Else
MsgBox "Funkcija get_cjena_imp: jedan od parametara je prazan",
vbCritical
End If
End Function