Form Reload Help (1 Viewer)

JCH40

New member
Local time
Today, 08:19
Joined
Apr 9, 2020
Messages
1
I currently have a master form that uses multiple subforms by setting their visibility on or off. I have created a reset button that when clicked fires the following code
Private Sub Reset_Click()
DoCmd.Close
DoCmd.OpenForm "MasterForm"
End Sub

The goal is to basically reset everything back to the way it was when I first open the form. And this works..... sort of. When I first click it, the location where the first subform shows up is a white box. If I click the reset button again, then it shows up correctly. What am I missing to make it to where I only have to click the button once to get it to work correctly.
The orange background is the subform

Here is what it looks like after clicking twice Here is what it looks like after clicking once
Capture1.PNG
--------------
Capture3.PNG


Thanks!
 

CJ_London

Super Moderator
Staff member
Local time
Today, 14:19
Joined
Feb 19, 2013
Messages
16,607
Can I suggest that rather than having multiple subforms controls, have a single subform control - and rather than code to make a subform visible, have code that sets the single subform control sourceobject to the name of the subform. Then your reset_click code would simply be

me.subformname.sourceobject="name of subform you want to display"
 

vba_php

Forum Troll
Local time
Today, 08:19
Joined
Oct 6, 2019
Messages
2,880
there's something wrong with your code JCH. post it. the issue is probably with one of these:

=> your main form's properties
=> your subform's properties
=> the code behind your button

on a side note, CJ said there's a better way to do this, and that's right. many other ways. you open to hearing them?
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 21:19
Joined
May 7, 2009
Messages
19,233
if the subform has No on it's AllowAdditions property, then it will
be blank if it is Linked to the mainform which is on New record.

you may also try Tab control (with Tab Style = None)
 

Users who are viewing this thread

Top Bottom