Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: MS Access using Oracle ODBC
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"in a recordset
' 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
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
![]() |
![]() |