Results 1 to 6 of 6
  1. #1
    newaccess is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    May 2010
    Posts
    33

    Question how to get oracle sequence value at form

    Hi Friends,



    I have a form that used to input data. there are a column as primary key at table and value comes from oracle sequences.

    the query works in database. However I got a message as run-time error 3078. the Microsoft access database engine cannot fine the input table or query'DUAL'. make sure it exists and that its name is spelled correctly. Click debug. cursor focus on
    Set rs1 = CurrentDb.OpenRecordset(strsql)

    Thanks for help. I use access97 in window 7.

    newaccess
    -------org code
    Private Sub Form_Open(Cancel As Integer)
    Dim dbExercise As DAO.Database
    Dim strid As Long
    Dim strsql As String
    Dim rs1 As DAO.Recordset
    Set dbExercise = CurrentDb

    strsql2 = "SELECT req_seq.NEXTVAL AS MaxInv FROM DUAL;"
    Set rs1 = CurrentDb.OpenRecordset(strsql)
    If rs1.BOF = False And rs1.EOF = False Then

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    You want to select next value of field req_seq from table DUAL? Never seen a sql like this in Access.

    Google: oracle nextval microsoft access

    Review http://www.techonthenet.com/access/q...ssthrough2.php
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    newaccess is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    May 2010
    Posts
    33
    Super Moderator ,
    Thanks for your information and works well!

    New access man

  4. #4
    newaccess is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    May 2010
    Posts
    33
    Super Moderator,

    I know we need to manual generated a form by test to add data and assign value to a field. we MUST do this way?
    I auto created a form based on a table by access that save lots of time during manual generated form .
    Do we have any way to assign this value to a form field?
    I try to assign id value as beow
    Private Sub Form_Open(Cancel As Integer)
    Dim dbExercise As DAO.Database
    Dim strid As Long
    Dim strsql As String
    Dim rs1 As DAO.Recordset
    Set dbExercise = CurrentDb
    Dim Msg, Style, Title, Help, Ctxt, Response, MyString


    MsgBox AssignNextVal()

    Me.CNN.Caption = AssignNextVal()

    With rs1
    rs1("REQ_ID").Value = AssignNextVal()
    End With

    ---
    thanks
    new access

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    "I know we need to manual generated a form by test to add data and assign value to a field. we MUST do this way?" I don't really understand question.

    What is wrong with the code - error message, wrong results, nothing happens?

    Try the form Current event instead of Open.

    I don't know much about working with Oracle database. I have only set links to Oracle tables, for read only, no write.

    If the form is bound to table then don't see need for recordset, just populate the field by reference to the form:

    If IsNull(Me.Req_ID) Then Me.Req_ID = AssignNextVal()

    Why setting the caption property of a label?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    newaccess is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    May 2010
    Posts
    33
    It works. Great help! Super moderator!

    Happy New year

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Find First number in sequence of numbers
    By losstww in forum Queries
    Replies: 4
    Last Post: 11-16-2012, 02:44 PM
  2. Sequence in Navigation Pan
    By AndreT in forum Access
    Replies: 1
    Last Post: 04-23-2012, 10:04 PM
  3. Enter new number in sequence in PO
    By tchirpich in forum Access
    Replies: 30
    Last Post: 12-30-2011, 11:24 AM
  4. Reverse Sequence of Numbers
    By OpsO in forum Queries
    Replies: 1
    Last Post: 08-12-2010, 06:05 PM
  5. Run queries in sequence and combo box
    By thart21 in forum Queries
    Replies: 10
    Last Post: 05-28-2010, 03:47 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums