Results 1 to 5 of 5
  1. #1
    SamL is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2021
    Location
    NJ
    Posts
    20

    displaying live records


    Hi, I'm far from new at Access programming, but I never needed to do this before.

    The company has many Providers, each provider has many Clients, each Provider has visited each Client numerous times. Each Client has issues, ranging from the medical to the physical to the mental. The average duration is about an hour, so a Provider might see many Clients in a day's work. The final table, called tblSessions, contains many fields regarding the visit (called a "session"), beyond date, time, and duration. Because of their hectic work days, the Providers only enter their data once in two-four weeks, while keeping copious notes on each session.

    The problem: they're not sure which entries they've completed and which ones still need to be entered. They want me to allow them to display the last 10 records they've entered. How do I program that? I'd rather program it rather than give them access to the live table. In VBA code, I've opened a Recordset, but it doesn't display the records. Please help.

    The code:
    Code:
    Private Sub cmbSelectProvider_AfterUpdate()
    
    
        Dim QrySession1 As QueryDef, rstQrySess1 As DAO.Recordset
        
        Set QrySession1 = CurrentDb.QueryDefs("qrySessionQry1")
        
        With QrySession1
            .Parameters("Enter Initials") = Me.cmbSelectProvider.Value
            Set rstQrySess1 = .OpenRecordset
    .
    .
    .
    .
    End Sub
    where qrySessionQry1 controls the data to be displayed. Thanks for your help. BTW, using the Immediate window, I've ascertained that Access is opening the correct records.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Well, you'd have to do something with the recordset. Personally I'd probably use a subform with a record source of a query that used the combo as a parameter. Requery it in the after update event of the combo. Actually that might produce a parameter prompt when the form first opens, so I'd use a query without parameters and let the master/child link properties of the subform keep it in sync with the combo.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    SamL is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2021
    Location
    NJ
    Posts
    20
    Thanks. I figured someone would say that. I tried that, though, and I get an error message saying I can't link unbound forms - on both the master and child forms. BTW, I read Ayn Rand's book (I can't remember the name, I only remember that it was a sequel to The Fountainhead, and opened with your motto) over 50 years ago, at age 21.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I think the master link would be

    Forms!FormName.ComboName

    and the child would be the field name. Can you attach the db here if you're still stuck?

    That quote is from Atlas Shrugged, which I should probably reread, it's been a long time.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    SamL is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2021
    Location
    NJ
    Posts
    20
    I finally got it, with G-d's help. I had no choice but to open the child with a parameter query, so I simply separated the two forms, and developed the child form into a complete display form. Then it finally occurred to me to change the parameter of the query to be tied directly to the value of the combobox (Criteria line reads 'Forms!frmSessionQry!cmbProvider.value' without the quotes). I also added the DoCmd.OpenForm command to the AfterUpdate event of the combo. Now the display form opens seamlessly when I update the combobox.

    I liked Atlas Shrugged because it presented numerous ideas and outlooks on life. It was a delight to read it, although it took forever. It's not a book; it's a tome! I read it when I was sick in bed with a bad cold. But one thing wrong with one idea the author threw at the reader: it's not a sin to do kindness, to do it for free, and to not expect, or even permit, remuneration. Doing a kindness really is a good deed, contrary to her premise.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Report not displaying all the records?
    By djspod in forum Reports
    Replies: 1
    Last Post: 08-27-2015, 07:44 AM
  2. Query not displaying all records
    By Eddy Sincere in forum Queries
    Replies: 7
    Last Post: 03-13-2015, 05:00 PM
  3. Records displaying Problem
    By drunkenneo in forum Forms
    Replies: 1
    Last Post: 06-25-2013, 08:48 AM
  4. Replies: 1
    Last Post: 11-08-2011, 07:44 PM
  5. Displaying records from a form
    By ceb39 in forum Access
    Replies: 5
    Last Post: 04-03-2009, 12:36 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums