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: MS Access using Oracle ODBC

Re: MS Access using Oracle ODBC

From: mark tomlinson <marktoml_at_gdi.net>
Date: Fri, 01 May 1998 13:52:13 GMT
Message-ID: <3549d344.148088980@newshost.us.oracle.com>


This works from Access....

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 Fri May 01 1998 - 08:52:13 CDT

Original text of this message

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