Hide fields/textbox when open based on a criteria

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

Guest

Hello.
I have a forma that can be open from 2 diferent forms. If the form A is open
from form Z, the form A shows all textbox. If the form A is open from form X,
only 1 textbox is visible.

How can I do this?

Regards,
Marco
 
You need to use OpenArgs to let Access know what to do!

Behind the button on FormZ

DoCmd.OpenForm "FormA", , , , , , "Show All Textboxes"

Behind button on FormX

Behind button on FormBDoCmd.OpenForm "FormA", , , , , , Me.OpenArgs = "Show
All Textboxes"

Then on FormA

Private Sub Form_Open(Cancel As Integer)

If Me.OpenArgs = "Show All Textboxes" Then
' Do nothing; all textboxes will be shown
ElseIf Me.OpenArgs =Me.OpenArgs = "Show All Textboxes" Then
'Place code here to make the Visible property of all textboxes except
one False
End If

End Sub
 
Hi.

I forgot to mention that both forms are using the same subform. in that case
should be something like if form Z is actived then ... else if form X is
activated then....

Right?

regards,
Marco
 
Hi. I'm trying with this but isn't working:


If [Forms]![3_form_MedicinaCurativa]![ID] <> "" Then
DoCmd.OpenForm "9_form_Visualizacao_Consultas_MedicinaCurativa", , , "id = "
& Me!ID, Me.OpenArgs = "Show All Textboxes"
Else
If [Forms]![11_form_MedicinaTrabalho]![ID] <> "" Then
DoCmd.OpenForm "9_form_Visualizacao_Consultas_MedicinaCurativa", , , "id = "
& Me!ID, Me.OpenArgs = "Don't Show All Textboxes"
End If
End If
 
Marco,

You could also try:

On Onopen from form A

If isloaded(z)
hide this....
else
hide this... (then it has to be the X form)
end if

just an alternative...
 
Back
Top