Set a Control Visibility from a command button on a previous form

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

Guest

How do I set visibility of a control on a form from a command button on a
previous form which is opening the new form?
 
Hi,
try:

DoCmd.OpenForm "YourFormName"
Forms!YourFormName.YourControlName.Visisble = True/False

HTH
Good luck
 
I've tried that but get an error message:
"run-time error '438'
Object doesn't support this property or method"
 
Did you just copied and pasted my code?
If yes...sorry I made a typo:

it should be ...Visible and not .Visisble!
It should work if you change that. If you set the property to TRUE the
control is visible if to FALSE it should hide.
HTH
Good luck
 
No I retyped the code -I had picked up the typo!
Here is the code I am using:

Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmHolderDetailsTempys"
stLinkCriteria = "[ID]=" & Me![ID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Forms!frmHolderDetailsTempys!btnPermitIssue.Visibility = False

DoCmd.Close acForm, Me.Name

The code works fine without the Visibility line
 
Hi,
its the visible property not the visibility property, so you picked up the
typo, but changed it to something wrong ;)
It would be:

Forms!frmHolderDetailsTempys!btnPermitIssue.Visible = False

HTH
Good luck
--
Oliver
Admin Specialist & Computer Science Major @ UMD - Go Terps - :)
http://www.oli-s.de


wilcoit said:
No I retyped the code -I had picked up the typo!
Here is the code I am using:

Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmHolderDetailsTempys"
stLinkCriteria = "[ID]=" & Me![ID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Forms!frmHolderDetailsTempys!btnPermitIssue.Visibility = False

DoCmd.Close acForm, Me.Name

The code works fine without the Visibility line
--
dtw


freakazeud said:
Did you just copied and pasted my code?
If yes...sorry I made a typo:

it should be ...Visible and not .Visisble!
It should work if you change that. If you set the property to TRUE the
control is visible if to FALSE it should hide.
HTH
Good luck
 
Thanks for that - it now works.
Sometimes you can be too close to see the obvious!
--
dtw


freakazeud said:
Hi,
its the visible property not the visibility property, so you picked up the
typo, but changed it to something wrong ;)
It would be:

Forms!frmHolderDetailsTempys!btnPermitIssue.Visible = False

HTH
Good luck
--
Oliver
Admin Specialist & Computer Science Major @ UMD - Go Terps - :)
http://www.oli-s.de


wilcoit said:
No I retyped the code -I had picked up the typo!
Here is the code I am using:

Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmHolderDetailsTempys"
stLinkCriteria = "[ID]=" & Me![ID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Forms!frmHolderDetailsTempys!btnPermitIssue.Visibility = False

DoCmd.Close acForm, Me.Name

The code works fine without the Visibility line
--
dtw


freakazeud said:
Did you just copied and pasted my code?
If yes...sorry I made a typo:

it should be ...Visible and not .Visisble!
It should work if you change that. If you set the property to TRUE the
control is visible if to FALSE it should hide.
HTH
Good luck
--
Oliver
Admin Specialist & Computer Science Major @ UMD - Go Terps - :)
http://www.oli-s.de


:

I've tried that but get an error message:
"run-time error '438'
Object doesn't support this property or method"
--
dtw


:

Hi,
try:

DoCmd.OpenForm "YourFormName"
Forms!YourFormName.YourControlName.Visisble = True/False

HTH
Good luck
--
Oliver
Admin Specialist & Computer Science Major @ UMD - Go Terps - :)
http://www.oli-s.de


:

How do I set visibility of a control on a form from a command button on a
previous form which is opening the new form?
 
I've tried that but get an error message:
"run-time error '438'
Object doesn't support this property or method"

Did you change "YourFormName" to what ever the actual form name is?
Did you change "YourControlName" to what ever the actual control name
is?
Did you correct the spelling of Visible?

it should have read:
DoCmd.OpenForm "YourFormName"
Forms!YourFormName!YourControlName.Visible = False
 
Back
Top