Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Why doesn't Access form display records?

Posted on 2011-02-24
3
Medium Priority
?
550 Views
Last Modified: 2012-05-11
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
    Else
        Me.lblUserName.Caption = "Not Logged In"
    End If
    Populate_Listbox_Existing
Exit_Procedure:
    Exit Sub
Trap_Error:
    MsgBox Current_Form & ":" & Current_Routine & ":" & Current_Activity & vbCrLf & Err.Number & "-" & Err.Description & " @ " & Err.Source
    Resume Exit_Procedure
End Sub
0
Comment
Question by:RichNH
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 34969711
get a print of the string "WhereString" and interrogate.
0
 
LVL 14

Accepted Solution

by:
Don Thomson earned 1000 total points
ID: 34970436
Have you tried setting the filer off on load - then immediately back on before continuing
0
 
LVL 1

Author Closing Comment

by:RichNH
ID: 34970530
Don't know what the problem is with this, but that worked.  Thank you.
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question