Results 1 to 4 of 4

Thread: Split form Refresh Problem
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    Board Regular gheyman's Avatar
    Join Date
    Nov 2005
    Location
    Orlando, FL USA
    Posts
    1,665
    Post Thanks / Like
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Default Split form Refresh Problem

    I have a split form based on Table. The below code runs an append query that updates the aforementioned table. My problem is that after the append query is run, the Split form does not refresh to show the new data that was added to the form. If I hit the Refresh button in the Ribbon the form does update, but I cannot seem to get it to update using VBA code. So my work around as you see below is to close the form and reopen it - ugh!

    Any suggestions how to make this better? Please, my VBA for Access is limited and really no SQL knowledge so please keep that in mind. I really appreciate your help!

    Code:
    Private Sub Command29_Click()
    On Error GoTo Command29_Click_Err
    
      DoCmd.SetWarnings False
    
    If IsNull(ComboVendorASL) Then
        DoCmd.GoToRecord , "", acNewRec
        
    Else
        DoCmd.OpenQuery "qry_vluVendor_MakeTable", acViewNormal, acEdit
        DoCmd.Close acQuery, "qry_vluVendor_MakeTable"
    
           
            DoCmd.Close , ""
            DoCmd.OpenForm "frm_Add_Supplier", acNormal, "", "", , acNormal
            DoCmd.GoToRecord , "", acLast
    End If
    
    Command29_Click_Exit:
        Exit Sub
    
    Command29_Click_Err:
        MsgBox Error$
        Resume Command29_Click_Exit
    
    End Sub
    G Heyman
    Northrop Grumman - Laser Systems'
    Apopka, FL

  2. #2
    Board Regular
    Join Date
    May 2013
    Posts
    667
    Post Thanks / Like
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Access Split form Refresh Problem

    Ever heard of the Refresh event for a form?

    https://docs.microsoft.com/en-us/off...s.form.refresh

    However I think you would need the requery method, not the refresh?
    Office 2007
    Access novice. Sometimes trying to give something back

  3. #3
    Board Regular gheyman's Avatar
    Join Date
    Nov 2005
    Location
    Orlando, FL USA
    Posts
    1,665
    Post Thanks / Like
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Access Split form Refresh Problem

    Tried both, neither worded
    Code:
    Private Sub Command29_Click()
    On Error GoTo Command29_Click_Err
    
      DoCmd.SetWarnings False
    
    If IsNull(ComboVendorASL) Then
        DoCmd.GoToRecord , "", acNewRec
        
    Else
        DoCmd.OpenQuery "qry_vluVendor_MakeTable", acViewNormal, acEdit
        DoCmd.Close acQuery, "qry_vluVendor_MakeTable"
        
        Me.Refresh
        Me.Requery
           
       '     DoCmd.Close , ""
       '     DoCmd.OpenForm "frm_Add_Supplier", acNormal, "", "", , acNormal
            DoCmd.GoToRecord , "", acLast
    End If
    
    Command29_Click_Exit:
        Exit Sub
    
    Command29_Click_Err:
        MsgBox Error$
        Resume Command29_Click_Exit
    
    End Sub
    G Heyman
    Northrop Grumman - Laser Systems'
    Apopka, FL

  4. #4
    Board Regular
    Join Date
    May 2013
    Posts
    667
    Post Thanks / Like
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Access Split form Refresh Problem

    Not sure what else to suggest.
    I would have thought that you would execute a MakeTable query and not just open it.?, but that does appear to be one of the options?
    https://www.fmsinc.com/MicrosoftAcce...ngMessages.htm
    You are setting warnings to false, but not back to True.?
    Why is an append query named MakeTable?

    Split forms do have some strange quirks, but I do not think this is one of them.
    Office 2007
    Access novice. Sometimes trying to give something back

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •