Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: MAX NUMBER

Re: MAX NUMBER

From: Reiro <ReiroGP_at_gmail.com>
Date: 24 Aug 2006 03:59:38 -0700
Message-ID: <1156417178.020176.77930@m79g2000cwm.googlegroups.com>

ok ... im using the foll: code....

Function AssignNextval() As Long

    Dim db As Database
    Dim LPassThrough As QueryDef
    Dim Lrs As dao.Recordset
    Dim LSQL As String

    On Error GoTo Err_Execute

    Set db = CurrentDb()

'Create a temporary passthrough query to retrieve the NextVal from
an Oracle sequence

    Set LPassThrough = db.CreateQueryDef("qryTemp")

'Use {Microsoft ODBC for Oracle} ODBC connection
    LPassThrough.Connect =
"ODBC;DSN=cssmam_main;UID=mam4;PWD=mam4;SERVER=jhb-cssmamapp"

    LPassThrough.SQL = "Select access_asset.nextval as NV From Dual"     LPassThrough.ReturnsRecords = True

    Set Lrs = LPassThrough.OpenRecordset(dbOpenSnapshot)

'Retrieve NextVal from Oracle sequence
    If Lrs.EOF = False Then

        AssignNextval = Lrs("NV")
    Else

        AssignNextval = 0
    End If

'Remove query definition when done

    CurrentDb.QueryDefs.Delete "qryTemp"

    Exit Function

Err_Execute:

'Remove query definition when done

    CurrentDb.QueryDefs.Delete "qryTemp"

'Return 0 if an error occurred

    AssignNextval = 0

End Function

nw im tryin to assign this value to a textbox on my access form

text12 = AssignNextval ()..... says function not allowed ......

and if go to the textbox > properties > data > default value = AssignNextval () .. on form load i get #NAME?

how can i know assign this value to a text box... Received on Thu Aug 24 2006 - 05:59:38 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US