declare the following function
Public Function GetSerialNum() As Long
Dim strSerial As String, rs_serial As New ADODB.Recordset
strSerial = "SELECT DBINFO(""SQLCA.SQLERRD1"") FROM ST_COMPANY" (to get single return)
CreateRecordset cnnDB, rs_serial, strSerial
GetSerialNum = rs_serial(0)
rs_serial.Close
End Function
then to use the function try the following
strSql = "INSERT INTO ps_end_of_day VALUES(0, " & BranchID & ", '" & Format(Date, "ddmmyyyy") & "', '" & Format(Time, "hh:mm") & "', " & UserId & ")"
cnnDB.Execute strSql
end_serial_num = GetSerialNum
works fine
regards
john