Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Syntax for invisible control 2

Status
Not open for further replies.

bikerted

Technical User
Nov 7, 2003
221
0
0
GB
I'm trying to make a control that isn't functional in a particular situation invisible so an erroneous result won't occur if it is used.

It's on a pop-up form called GA Tracking (I know spaces are anathema!) and it's called Combo30. It also has a label next to it to make invisible. I can't seem to get the syntax right. Her's the overall code from GA Tracking button OnClick event:

Private Sub GATrackingOpen_Click()
On Error GoTo Err_GATrackingOpen_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "GA Tracking"

stLinkCriteria = "[Payee ID]=" & Me![Payee ID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Me![Gift Aid Tracking]Combo30.Visible = False

Exit_GATrackingOpen_Click:
Exit Sub

Err_GATrackingOpen_Click:
MsgBox Err.Description
Resume Exit_GATrackingOpen_Click

End Sub

I know I'm probably way off, but could someone "throw me a line" - of code that is?!

Thanks.

Ted.
 
Ted,

Leave out

Me![Gift Aid Tracking]Combo30.Visible = False

and place

Me.Combo30.visible = false on the popup form's open event. I'm guessing that [Gift Aid Tracking] is your popup form.

If you want to pass more information from the calling form to the called form, have a look at the OpenArgs method.

Cheers,
Bill
 
Thanks formerTexan,

Sorry, I should have (as ever!) made myself clearer, I want the control on the pop-up to be visible only when open from another calling form but not this one - because it can't function on this form but can on the other. Surely it will always be invisible - unless conditions are placed on when it can be visible - if it's OnOpen event is coded?

Ted.
 
Also, should there not be a ! between [GiftAidTracking] and Combo30?

Have fun! :eek:)

Alex Middleton
 
As I understand it, you would like combo30 on GATracking to be visible when called from one form, but not visible when called from another.

if so, you can do this using OpenArgs as follows:

On the form calling GATracking where combo30 is to be invisible, change the coCmd.openForm

from: DoCmd.OpenForm stDocName, , , stLinkCriteria

to: DoCmd.OpenForm stDocName, , , stLinkCriteria, , , "MakeComboInvisible"

The MakeComboInvisible part is the openArg

In the onOpen event of GATracking, place the following:

==========
If Me.OpenArgs = "MakeComboInvisible" Then
Me!Combo30.Visible = False
End If

========

On on forms where you want the combo to be visible, just leave out the MakeCombInvisible part (and the three preceding commas)
 
greely,

You are a life-saver. I wouldn't have come up with that. I have so much to learn. I need a reference source (not Microsoft's confusing one?) to all these arguments and methods, etc. I'll never remember them all!

Thanks a million!

Ted.
 
I need a reference source to all these arguments and methods, etc.
When in VBE feel free to play with the F2 (Object browser) and F1 (VBA help) keys.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
To give credit where credit is due:

formerTexan had given a direction to OpenArgs in his previous post.

Glad to help

Ron

-isn't it great when it works the first time?
 
Thank you all for your contributions - I gave formerTexan and greely stars(though the the two stars don't seem to reflect this?). Nevertheless, it all works well and yes it is great when it works first time. Thanks PHV for your suggestion. I guess I'll persevere, but I'm frustrated by a lack of progress - continually pasting other's code!

Best wishes,

Ted.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top