Why does my form go completely blank? The entire form goes blank.

cliftonx

Registered User.
Local time
Today, 05:08
Joined
Mar 4, 2010
Messages
27
I have a button on a subform that allows a user to add a new task record. When the "Add New Task" button get pressed,
a pop-up window appears that allows a user to enter a new task record. The pop up window contains a "Save and Close"
button. When the user enters a new record on pop-up window and clicks the "Save and Close" button, an on-click event
get fired. The on-click event sub-procedure will save the new Task record, and execute the following statements:

'Set the focus back to the sub-form
Form!Mainform-1650.Form!SubForm1.Form!TabTaskOutstanding.SetFocus

'Requery the sub-form so that the user can see their newly updated task information.
Form!Mainform-1650.Form!SubForm1.Form!TabTaskOutstanding.Form.Requery
 
I don't understand your particular problem but if you mean the form went blank not even showing any controls that could be a symptom of a form with an empty record source and the Allow Additions property being set to No.
 
Last edited:
I don't understand you particular problem but if you mean the form went blank not even showing any controls that could be a symptom of a form with an empty record source and the Allow Additions property being set to No.

or no records, and a non-updateable query.

you get the same result.
 
You've gotten the short answers...either one of which may be the problem, here...here's the long answer:

Controls don't appear in Form View when three conditions exist at the same time:

  • The Form is Bound to a Table or Query
  • There are No Records in the underlying Recordset or the Recordset cannot be accessed
  • The Form cannot have New Records added
The reasons that a Bound Form cannot have New Records added include:

  1. AllowAdditions for the Form is set to No
  2. The underlying Query the Form is based on is Read Only
  3. User doesn't have Read and/or Write Permission for the Folder where the Data resides or there is a connection problem with the network.
  4. Folder the File resides in (in versions 2007/2010/2013/2016 ) not having been declared as 'Trusted'
  5. Form's Recordset Type is set to Snapshot
Linq ;0)>
 
Thanks Everyone!!!

I solved the problem. I had inserted the SetFocus and Requery statements right before I had saved and closed the table in the Pop-up window. I simply moved the code below the save and close statement and it worked. :)

Excerpt for code:

DoCmd.Save 'save table from pop-up form

DoCmd.Close 'close pop-up form

If CurrentProject.AllForms("frmMain_expandlg_1650").IsLoaded Then
Forms!frmMain_expandlg_1650!SubForm1.Form TaskOutstanding.SetFocus
Forms!frmMain_expandlg_1650!SubForm1.Form!TaskOutstanding.Form.Requery
Else
'Use another technique to find the MainForm
End If
 
...
Excerpt for code:

DoCmd.Save 'save table from pop-up form
..
You don't need the command DoCmd.Save, only if you've made changes to the form or table, it doesn't save the data.
 

Users who are viewing this thread

Back
Top Bottom