W
Webtechie
Hello,
I have a userform in Excel. I am creating a recordset to an Access database.
I've created the recordset and can now populate my fields. However, I need
the user to be able to go back word and forward.
I am using a spin control on a userform to naviate. When the user clicks
up, I need to get the previous record.
I can't figure out how, using an ADO recordset on the , to get the previous
record.
dim iCurrentRecord as integer
'Create the recordset
'********************
Set rsGuestData = New ADODB.Recordset
'Is connection open?
'*******************
If myConnection Is Nothing Then
ConnectToDatabase
End If
'Get connection from the pool
'****************************
myConnection.Open
'Create SQL Statement
'********************
mySQL = "select * from tblGuest " _
& " where employeeid = " & thisEmployeeID _
& " and deptid = " & thisDept
Set rsGuestData.ActiveConnection = myConnection
iCurrentRecord = frmKeyLeads.spincontrol.value
With rsGuestData
.Source = mySQL
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.LockType = adLockOptimistic
.Open Options:=adCmdText
.bookmark = iCurrentRecord - errors
..moveprevious
End With
I have a userform in Excel. I am creating a recordset to an Access database.
I've created the recordset and can now populate my fields. However, I need
the user to be able to go back word and forward.
I am using a spin control on a userform to naviate. When the user clicks
up, I need to get the previous record.
I can't figure out how, using an ADO recordset on the , to get the previous
record.
dim iCurrentRecord as integer
'Create the recordset
'********************
Set rsGuestData = New ADODB.Recordset
'Is connection open?
'*******************
If myConnection Is Nothing Then
ConnectToDatabase
End If
'Get connection from the pool
'****************************
myConnection.Open
'Create SQL Statement
'********************
mySQL = "select * from tblGuest " _
& " where employeeid = " & thisEmployeeID _
& " and deptid = " & thisDept
Set rsGuestData.ActiveConnection = myConnection
iCurrentRecord = frmKeyLeads.spincontrol.value
With rsGuestData
.Source = mySQL
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.LockType = adLockOptimistic
.Open Options:=adCmdText
.bookmark = iCurrentRecord - errors
..moveprevious
End With