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

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?
 
G

Guest

Hi,
try:

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

HTH
Good luck
 
G

Guest

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

Guest

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
 
G

Guest

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
 
G

Guest

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
 
G

Guest

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?
 
F

fredg

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
 

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

Top