SubForm Record Counter (1 Viewer)

kirkm

Registered User.
Local time
Today, 12:47
Joined
Oct 30, 2008
Messages
1,257
What instruction would force the Record 1 of xx countedr to populate as the Form loads?
This used to happen automatically but now only when any record (except record1) is clicked. Then record1 will as well.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 08:47
Joined
May 7, 2009
Messages
19,242
on the Load Event of the Form:

Code:
Private sub Form_Load()
With Me.Recordset
    If Not (.BOF And .EOF) Then
         .MoveLast
         .MoveFirst
    End If
End With
End Sub
 

kirkm

Registered User.
Local time
Today, 12:47
Joined
Oct 30, 2008
Messages
1,257
It didn't work. I tried it both in the mainForm Load and subForm Load.
No error though, but no change. Record selector Numbers are blank.
I'll put my Code here in case I've mucked something up
Code:
Private Sub Form_Load()
    Text18 = "dd mmm yyyy"
    Text2 = "36_001"

    With Me.ListView0
           .ColumnHeaders.Add , , "", 8000
           .HideColumnHeaders = True
           .View = lvwReport
           .GridLines = False
           .SpecialEffect = 3
           .ListItems.Clear
    End With

    [Form_qryBB subform].RecordSource = "SELECT qryBB.Prefix, qryBB.CH, qryBB.[40], qryBB.[10], qryBB.[#], qryBB.High, qryBB.Artist, qryBB.Title, qryBB.[A-Time], qryBB.[A-Side Composer], qryBB.[B-Side Artist], qryBB.[B-Side Title], qryBB.[B-Time], qryBB.[B-Side Composer], qryBB.Number, qryBB.Label, qryBB.[Date Entered], qryBB.[Date Peaked], qryBB.[Date Left] FROM qryBB;"

    DoCmd.MoveSize 500, 2400, 19500, 8200
    DoCmd.NavigateTo "acNavigationCategoryObjectType"
    DoCmd.Minimize
    Call [Form_qryBB subform].Prefix_Click
End Sub
and the subform
Code:
Private Sub Form_Load()
With Me
    .Prefix.ColumnWidth = 950

    .CH.ColumnWidth = 430
    .[40].ColumnWidth = 430
    .[10].ColumnWidth = 430
    .[#].ColumnWidth = 430
    .High.ColumnWidth = 430

    .artist.ColumnWidth = 3000
    .title.ColumnWidth = 3000
    .[A-Time].ColumnWidth = 820
    .[A-Side Composer].ColumnWidth = 3000

    .[B-Side Artist].ColumnWidth = 3000
    .[B-Side Title].ColumnWidth = 3000
    .[B-Time].ColumnWidth = 820
    .[B-Side Composer].ColumnWidth = 3000

    .Label.ColumnWidth = 990
    .Number.ColumnWidth = 990

    .[Date Entered].ColumnWidth = 1200
    .[Date Peaked].ColumnWidth = 1200
    .[Date Left].ColumnWidth = 1200
    With .Recordset
        If Not (.BOF And .EOF) Then
            .MoveLast
            .MoveFirst
        End If
    End With
End With
End Sub
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 08:47
Joined
May 7, 2009
Messages
19,242
I think along this line:
Code:
Private Sub Form_Load()
    Text18 = "dd mmm yyyy"
    Text2 = "36_001"

    With Me.ListView0
           .ColumnHeaders.Add , , "", 8000
           .HideColumnHeaders = True
           .View = lvwReport
           .GridLines = False
           .SpecialEffect = 3
           .ListItems.Clear
    End With

    With [Form_qryBB subform]
        .RecordSource = "SELECT qryBB.Prefix, qryBB.CH, qryBB.[40], qryBB.[10], qryBB.[#], qryBB.High, qryBB.Artist, qryBB.Title, qryBB.[A-Time], qryBB.[A-Side Composer], qryBB.[B-Side Artist], qryBB.[B-Side Title], qryBB.[B-Time], qryBB.[B-Side Composer], qryBB.Number, qryBB.Label, qryBB.[Date Entered], qryBB.[Date Peaked], qryBB.[Date Left] FROM qryBB;"
        With .Recordset
            .MoveLast
            .MoveFirst
        End With
    End With
...
...
...
 

kirkm

Registered User.
Local time
Today, 12:47
Joined
Oct 30, 2008
Messages
1,257
This is odd, that didn't work either. Then I found If qryBB includes an Order By clause, then it works.
However qryBB is already sorted by fields in the table, that aren't in the query.
What would you advise? Should I add them to the query and Order by them? There's 3 sorted fields.
 

kirkm

Registered User.
Local time
Today, 12:47
Joined
Oct 30, 2008
Messages
1,257
arnelgp, I have it sorted. For some reason (not even known to me!) I was setting the record source with SQL Select string, but the query itself already existed.
Changing the string to the query name has it showing the Record count correctly.
 

Users who are viewing this thread

Top Bottom