works in adp but not in ade

R

Robert Batt

Hello,
I have the following code that highlights a
particular active record in a continuous form when the
form is loaded using the gotorecord command. This
procedure works fine in an adp but when the ade is built
it seems to ignore this code and just highlights the top
record each time. why does it do this and how can I get
this code to work.

Regards
David

Private Sub HighlightActiveBusiness()

' rds uk-jdet-5lvf8l 18/12/2003 - highlight the
current active business
Dim sql As String
Dim Conn As New ADODB.Connection
Dim rst1 As New ADODB.Recordset
Dim IntActiveBusinessId As Integer
Dim IntCurrentId As Integer

IntCurrentId = Forms![frmBusinessDetails]!
[BusinessDetailsKey]
sql = "SPSchedSelectActiveBusiness"

Set Conn = Application.CurrentProject.Connection
Set rst1 = New ADODB.Recordset
Conn.CommandTimeout = 0
rst1.Open sql, Conn, adOpenDynamic, adLockOptimistic,
adCmdStoredProc

If (Not (rst1.EOF)) Then
IntActiveBusinessId = rst1!BusinessID
End If

While IntCurrentId <> IntActiveBusinessId
DoCmd.GoToRecord , , acNext
IntCurrentId = Forms![frmBusinessDetails]!
[BusinessDetailsKey]
Wend
Set rst1 = Nothing
Set Conn = Nothing


End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top