Hide and unhide a form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form, frmStopDailyCounttest in which the user clicks the command
button cmdAddstats, which, if there's a value being entered which duplicates
something already in the table, then opens frmDuplicateValues. When
frmDuplicateValues is opened, what can I do to hide the
frmStopDailyCounttest, and when it's closed, how can I unhide it?
 
Nathan Wolfe said:
I have a form, frmStopDailyCounttest in which the user clicks the command
button cmdAddstats, which, if there's a value being entered which
duplicates
something already in the table, then opens frmDuplicateValues. When
frmDuplicateValues is opened, what can I do to hide the
frmStopDailyCounttest, and when it's closed, how can I unhide it?

The syntax for showing or hiding a form is:

Forms!frmStopDailyCounttest.Visible = False ' or True

or:

Forms!frmDuplicateValues.Visible = False ' or True

Depending upon which form you want to hide or show.
 
That's what I thought, but I guess I must have been putting it in the wrong
event. I had put it in my On Click event for the primary form
(frmStopDailyCounttest), but it didn't seem to work (that is, it didn't set
the form to not visible).
 
I just tested the following with a button named cmdOpenForm2 on Form1:

Private Sub cmdOpenForm2_Click()
On Error GoTo Err_cmdOpenForm2_Click
Dim stDocName As String

DoCmd.OpenForm Form2, , , stLinkCriteria
Me.Visible = False

Exit_cmdOpenForm2_Click:
Exit Sub

Err_cmdOpenForm2_Click:
MsgBox Err.Description
Resume Exit_cmdOpenForm2_Click

End Sub

Me is used as a shortcut for the current form running the code. It works as
you require.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com
 
Back
Top