Results 1 to 2 of 2
  1. #1
    amkp711 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Dec 2014
    Posts
    14

    Recordset code forcing focus to remain on subform

    Hello! I am hoping this is a silly coding error, and it likely is. Forgive me if I do not give enough detail, I am new to this.

    I am building a tracking database that will be used to schedule appointments for various people. Currently, I am working with 2 forms and 2 subforms. The first form (frm_Client List) is a client overview form which shows all clients in a split form manner and seems to be working perfectly. The second (frm_Client Info) shows further details on a specific client by their unique "DB ID". On the client info form, I have 2 subforms both linking to queries on a session tracking table. The session tracking is linked up via the clients DB ID and then queried by date (I am working on giving a time guideline too) to split into upcoming sessions and past sessions (which then appear as subforms on frm_Client Info). From there, I am using a recordset code on the Upcoming session subform to select the next session and show that info (time and date) on an auto-updated banner for the database. I have that part working with the following code in the form load event of frm_Client Info (if there is an easier way to do this, which I am sure there is, PLEASE let me know!!!):


    Code:
    Private Sub Form_Load()
    Dim Care_Coach_Database As DAO.Database
    Dim rcdNextSession As DAO.Recordset
    Set Care_Coach_Database = CurrentDb
    Set rcdNextSession = Care_Coach_Database.OpenRecordset("Upcoming Sessions")
    rcdNextSession.FindFirst ("Session_Date" >= Date)
    If rcdNextSession.NoMatch = False Then
        Me.Next_Session_Alert = "Next Session Will Be On " & rcdNextSession("Session Date") & " At " & rcdNextSession("Session Time") & ", " & rcdNextSession("Type of Session")
    Else
        Me.Next_Session_Alert = "This patient has no upcoming sessions scheduled"
    End If
    rcdNextSession.Close
    End Sub
    Here is the issue:
    1) Whenever I make a change now to the subform (for upcoming sessions), I cannot click anywhere else on the frm_Client Info (the database does not change focus from the subform) and when I go to close the form it gives me an alert that the database cannot save the changes to the record. This is obviously a big issue and I am not sure how to get around it.

    2)I cannot cause this to autoupdate the banner after the form has loaded. I tried to put the same code in frm_Client Info's timer event and After Update event but that did not work. I am guessing that these issues are very much connected...

    PLEASE HELP ME! I need to get this working ASAP and I am not sure what the issue is... THANK YOU!!!!

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    If you want to provide db for analysis, follow instructions at bottom of my post.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Calcuate How many days remain in sharepoint
    By sdc1234 in forum SharePoint
    Replies: 2
    Last Post: 10-01-2014, 05:51 AM
  2. Replies: 6
    Last Post: 05-05-2012, 08:43 AM
  3. Set Focus on Subform
    By GCS in forum Forms
    Replies: 1
    Last Post: 12-01-2011, 11:46 AM
  4. Remain on Current Record
    By billgyrotech in forum Forms
    Replies: 17
    Last Post: 08-08-2011, 12:15 PM
  5. Replies: 15
    Last Post: 11-09-2010, 04:27 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