Why doesn't Access form display records?
Posted on 2011-02-24
I have a model form which is bound to a table. I call it using this command:
DoCmd.OpenForm "frmEndUserContacts2", , , WhereString, , acDialog, Argument
When the form displays there isn't any data in the fields and attempts to move it about its recordset via the record navigator are fruitless, there are zero records displayed. However, the filter flag is on. When I click the filter flag to turn it off all the records in the table are now accessible, as they should be. When I click the filter flag again to turn the filter back on the record I was filtering for correctly displays.
Question: Why isn't the record I'm filtering for displaying when I first open the form? The filter is correct yet I have to cycle through turning the filter off then on in order to get the recordset to properly pick up the record. Why isn't the recordset being initialized properly when I first open the form?
I used the debug immediate window to check me.recordset.recordcount & me.recordsource at the end of formload and also in the keyup event (after the form is completely loaded) and in both cases the recordsource is set to the table and the recordcount = 0. Yet once I cycle through the filter flag, everything works properly. All my other forms properly display the records filtered for upon initial load & display.
Here's the code in the formload event, nothing out of the ordinary from what I can see (the Populate_Listbox_Existing routine correctly populates an unbound listbox on the form).
Private Sub Form_Load()
Dim L1 As Long
On Error GoTo Trap_Error: Current_Activity = "": Current_Form = "frmEndUserContacts2": Current_Routine = "Form_Load"
EndUserKey = Split(Me.OpenArgs, ":")(1)
If FullName > "" Then
Me.lblUserName.Caption = FullName
Me.lblUserName.Caption = "Not Logged In"
MsgBox Current_Form & ":" & Current_Routine & ":" & Current_Activity & vbCrLf & Err.Number & "-" & Err.Description & " @ " & Err.Source