Continuous Form - only one record showing - white space below

essaytee

Need a good one-liner.
Local time
Today, 14:36
Joined
Oct 20, 2008
Messages
546
Hope someone can shed some light on this. Using a Continuous Form, every time I change the Recordsource of the Form via VBA, only one record is displayed and is positioned at the top of the window. White space is below the record, even though all the required records have been returned. The vertical scrollbar is positioned at the bottom, and when clicking on the scrollbar, all the records then appear in the allotted space.

After changing the recordsource of the form, how in code can I show all records in the space available?

I'm using Access 2010.
 
It sounds like you are going to the last record. Try adding a
Code:
DoCmd.GoToRecord , , acFirst
to your code, after setting the recordsource
 
Also, how about after changing the recordsour,e you requery youe form
 
I've found the possible culprit. On the form, in the header, I have a text box, the control source is set to a user defined function (public). The function takes the current Form as an argument and returns a count of filtered records.

The text box control source : =CFilterRecordsCount(Forms("frm_Event_List"))

In that public function, I had the following snippet: (pFrm is the passed in Form)
Code:
            Set rst = pFrm.Recordset
            lngCount = rst.RecordCount
            Set rst = Nothing

When I changed Recordset to RecordsetClone the issue was no longer; the records are correctly displayed in the allotted space.

The correct snippet is:
Code:
            Set rst = pFrm.RecordsetClone
            lngCount = rst.RecordCount
            Set rst = Nothing

All afternoon this issue was stumping me, and as per usual after posting the problem, I find a solution. It may prove useful to others.
 
It sounds like you are going to the last record. Try adding a
Code:
DoCmd.GoToRecord , , acFirst
to your code, after setting the recordsource

Yes, I fiddled with this but didn't do the trick. I've subsequently solved the issue.
 

Users who are viewing this thread

Back
Top Bottom