Question : Limit number of displayed rows in continuous form

Hello -
I am working with a continuous form. The records that will be worked with are loaded in another process, and this particular form does not allow the addition, deletion or data entry of records; strictly edits. Navigation buttons are not displayed. My problem is that I still get an extra blank record displayed at the end in the detail area. That is to say, if the form's recordset has four records, I'm getting a 5th blank record displayed. How do I keep this blank record from appearing?
Thanks,
Todd

Answer : Limit number of displayed rows in continuous form

Ok - I have eliminated the error by using an ADO recordset for the form recordset (see the code below).
I've already spent way too much time on this, but wouild still like to know why this happened. I am going to open a new question focusing on the 'why'
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
Private Sub SetRst()
      Dim strSQL As String
      Dim rst As ADODB.Recordset
      Const strProcedure As String = "SetRst"
10    On Error GoTo ErrorHandler
 
20    strSQL = "SELECT Item1, Item2, Item3, Item4, Item5, Item6, " & _
               "EvaluationID, FormID FROM tblItems WHERE EvaluationID = " & _
               lngEvalID & " AND FormID = " & lngFormID
 
30    Set rst = New ADODB.Recordset
40    With rst
50          .Open strSQL, CurrentProject.Connection, _
            adOpenKeyset, adLockOptimistic, adCmdText
                 
         ' Check if any records were retrieved
60       If Not (.BOF And .EOF) Then
70          Set Me.Form.Recordset = rst
80       Else
90          MsgBox "No Records Found!"
100         .Close
110         Set rst = Nothing
120      End If                     'If Not (rst.RecordCount = 0)
130   End With                      'With rst
 
ExitSub:
140   On Error GoTo 0
150   Exit Sub
 
ErrorHandler:
160   HandleError strModule, strProcedure, Err.Description, Err.Number, Erl
170   Resume ExitSub
End Sub
Random Solutions  
 
programming4us programming4us