Split form Refresh Problem

gheyman

Well-known Member
Joined
Nov 14, 2005
Messages
1,835
Office Version
  1. 365
Platform
  1. Windows
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
 

Some videos you may like

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.

gheyman

Well-known Member
Joined
Nov 14, 2005
Messages
1,835
Office Version
  1. 365
Platform
  1. Windows
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
 

welshgasman

Well-known Member
Joined
May 25, 2013
Messages
880
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/MicrosoftAccess/query/action-queries/SuppressWarningMessages.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.
 

Watch MrExcel Video

Forum statistics

Threads
1,127,444
Messages
5,624,809
Members
416,055
Latest member
EJGAJG

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top