Problems with hiding buttons

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

Guest

I have a switchboard that contains a button that opens with my inventory
field form.

This button contain is the following OnClick:

Private Sub buttonVIEWSIGNRECORDS_Click()
On Error GoTo Err_buttonVIEWSIGNRECORDS_Click

Dim stDocName As String
Dim stLinkCriteria As String

Forms!frmMainSwitchBoard.Visible = False

stDocName = "Form Sign Inventory"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Forms![Form Sign Inventory]!Command151.Visible = False

Exit_buttonVIEWSIGNRECORDS_Click:
Exit Sub

Err_buttonVIEWSIGNRECORDS_Click:
MsgBox Err.Description
Resume Exit_buttonVIEWSIGNRECORDS_Click

End Sub

The problem is that now the Command151 is not being hiden when the inventory
form opens. This worked fine for a long time, but recently I noticed it has
stopped.

My OnOpen event of the inventory form is as follows:

Private Sub Form_Open(Cancel As Integer)
DoCmd.SetWarnings False
DoCmd.OpenQuery "qryImagePathUpdate"
DoCmd.SetWarnings True

End Sub

Thanks for the help.
 
Hey Mike,

First of all, it is good coding practice to name your controls/fields,
tables, queries, forms, reports, macros, and modules without spaces.
It might be a pain to change but it can help avoid a lot of errors. I
used to receive unexplained errors frequently until I changed my naming
conventions.

If you do make this change, I would rewrite this line Forms![Form Sign
Inventory]!Command151.Visible = False as follows:

Me.FormSignInventory.Command151.Visible = False

Hope it helps.

Tammy
 
Thanks for the information. Unfortunately it does not help solve my overall
problem at this point.

For some reason, my [Form Sign Inventory] does not follow the visible
settings from the button on my switchboard [frmMainSwitchBoard].

I made a test form and used the same coding to hide a button on it and it
worked, so the problem is not with the coding of the command button on the
switchboard, it is something to do with my [Form Sign Inventory].

Still stumped...
 
More information:
Here is the overall problem/wanted operation.

[Form Sign Inventory] can be opened from different forms, the SwitchBoard
[frmMainSwitchBoard], and then 3 other search forms.

If the [Form Sign Inventory] is opened from the [frmMainSwitchBoard] i want
a close button to be shown on [Form Sign Inventory] that will close to the
[frmMainSwitchBoard]. Likewise, if [Form Sign Inventory] is opened from the
search forms, I would like another close button to be visible to make sure
the [Form Sign Inventory] close/returns to search form.

That is what I want to happen.

Is there a way to handle the above on [Form Sign Inventory] instead of on
buttons on the other forms?

Mike said:
Thanks for the information. Unfortunately it does not help solve my overall
problem at this point.

For some reason, my [Form Sign Inventory] does not follow the visible
settings from the button on my switchboard [frmMainSwitchBoard].

I made a test form and used the same coding to hide a button on it and it
worked, so the problem is not with the coding of the command button on the
switchboard, it is something to do with my [Form Sign Inventory].

Still stumped...

FireGeek822 said:
Hey Mike,

First of all, it is good coding practice to name your controls/fields,
tables, queries, forms, reports, macros, and modules without spaces.
It might be a pain to change but it can help avoid a lot of errors. I
used to receive unexplained errors frequently until I changed my naming
conventions.

If you do make this change, I would rewrite this line Forms![Form Sign
Inventory]!Command151.Visible = False as follows:

Me.FormSignInventory.Command151.Visible = False

Hope it helps.

Tammy
 
Problem solved. I found a rogue function in a different command button, that
made a field null on click. Removal of this expression solved the problem.
Go figure.

Mike said:
More information:
Here is the overall problem/wanted operation.

[Form Sign Inventory] can be opened from different forms, the SwitchBoard
[frmMainSwitchBoard], and then 3 other search forms.

If the [Form Sign Inventory] is opened from the [frmMainSwitchBoard] i want
a close button to be shown on [Form Sign Inventory] that will close to the
[frmMainSwitchBoard]. Likewise, if [Form Sign Inventory] is opened from the
search forms, I would like another close button to be visible to make sure
the [Form Sign Inventory] close/returns to search form.

That is what I want to happen.

Is there a way to handle the above on [Form Sign Inventory] instead of on
buttons on the other forms?

Mike said:
Thanks for the information. Unfortunately it does not help solve my overall
problem at this point.

For some reason, my [Form Sign Inventory] does not follow the visible
settings from the button on my switchboard [frmMainSwitchBoard].

I made a test form and used the same coding to hide a button on it and it
worked, so the problem is not with the coding of the command button on the
switchboard, it is something to do with my [Form Sign Inventory].

Still stumped...

FireGeek822 said:
Hey Mike,

First of all, it is good coding practice to name your controls/fields,
tables, queries, forms, reports, macros, and modules without spaces.
It might be a pain to change but it can help avoid a lot of errors. I
used to receive unexplained errors frequently until I changed my naming
conventions.

If you do make this change, I would rewrite this line Forms![Form Sign
Inventory]!Command151.Visible = False as follows:

Me.FormSignInventory.Command151.Visible = False

Hope it helps.

Tammy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top