4
Contributors
3
Replies
4
Views
9 Years
Discussion Span
Last Post by Jx_Man
0

Function GetRecord()

Dim ConnectionStr As String
Dim Uconnection As ADODB.Connection
Dim rs As ADODB.Recordset


ConnectionStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & DatabasePath & "\databasefilename.mdb;Persist Security Info=False"
Set Uconnection = New Connection
Uconnection.ConnectionString = ConnectionStr
Uconnection.CommandTimeout = 120000
Uconnection.Open
Set rs = New Recordset
rs.CursorLocation = adUseClient
strQry="Select Name,Id from tablename"
rs.Open strQry, Uconnection, adOpenDynamic, adLockOptimistic
strQry = ""
Set GetRecord = rs

End Function

0

this if your using a DE...

dim rs as new adodb.recordset
set rs = new adodb.recordset

if rs.state = 1 then rs.close
rs.open "SELECT NAME, ID FROM TABLE", DataEnvironment1.Connection1, adOpenDynamic, adLockOptimistic

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.