Re: MS Access and Oracle

From: Mark Tomlinson <marktoml_at_gdi.net>
Date: 1998/08/17
Message-ID: <35d84b02.7130743_at_newshost.us.oracle.com>#1/1


Option Compare Database
Option Explicit

' Form should have two controls
'    Command button - Command1
'    Text box       - Text1
'
' Seq is a user created Sequence
'

Private Sub Command1_Click()

    Dim odb As Database
    Dim qdfSqc As QueryDef
    Dim rstSeq As Recordset
    Dim ResultVal As Double
    Set odb = OpenDatabase("DB1.mdb") 'Open Database to current Access DB     

    Set qdfSqc = odb.CreateQueryDef("") ' Initialize QueryDef object

    With qdfSqc

        .Connect = "ODBC;DSN=local8;UID=scott;PWD=tiger"

' Connect Querydef to Oracle
DB via ODBC .SQL = "SELECT Seq.NEXTVAL from DUAL"
' Set SQL statement in
QueryDef Set rstSeq = .OpenRecordset()
' Store result from QueryDef
in a recordset

    End With

' Store returned value in a
variable

    ResultVal = rstSeq("NEXTVAL")

' Set focus to control to show
result

    Text1.SetFocus

' Display Value returned in a
textbox

    Text1.Text = ResultVal
End Sub Received on Mon Aug 17 1998 - 00:00:00 CEST

Original text of this message