By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,665 Members | 2,646 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,665 IT Pros & Developers. It's quick & easy.

Changing visibility of textboxes and labels in runtime in ms access?

P: 99
On a subform I have two textboxes and 2 labels of which I would need to change visibility on click of a label on the mainform.I do not know where to do this as the textboxes in the main form are not identified on the subform and vice versa.Can someone help me out?
Mar 3 '12 #1

✓ answered by NeoPa

Referring to Items on a Sub-Form should help with that HiGu.

Share this Question
Share on Google+
7 Replies


100+
P: 167
hi HiGu,
Here is how you refer to subforms and controls on it. Let's assume:
Subform name: "sfSubForm"
Label on the subform: "lblLabel"
Your code to hide label on the subform should be:
Expand|Select|Wrap|Line Numbers
  1. Me!sfSubForm.Form!lblLabel.Visible = False
Change False to True if you want to show the label.
Mar 3 '12 #2

NeoPa
Expert Mod 15k+
P: 31,273
Referring to Items on a Sub-Form should help with that HiGu.
Mar 3 '12 #3

P: 99
hey,thanks both of you.This seems to be working fine.
Mar 5 '12 #4

P: 99
Hi hjozinovic, your code worked wel while changing value of a textbox but not for changing captions.The one that worked for captions was the following that is referred in NeoPa's post.
Expand|Select|Wrap|Line Numbers
  1. Forms("frmWOMAINMENU").[frmWOMAINSUBMENU].Form.[lblhrs].Caption = "hrs"
  2.  
But I could not change controlsource of some textboxes on the same subform using the above methods.
Mar 5 '12 #5

NeoPa
Expert Mod 15k+
P: 31,273
Yes. It should work the same way. If you have a problem though, you need to post it (properly - not like this) in a new thread with the associated details included.
Mar 5 '12 #6

P: 99
I have just started a new thread on the same.You may delete the above posts {Since deleted -NeoPa} as they make no sense but I'll be grateful if you answer my new thread.
Mar 6 '12 #7

NeoPa
Expert Mod 15k+
P: 31,273
Posts deleted HiGu, but if you post the link to the (specific) new question in here then I can look at it more directly for you. It may not be something I can help with butI can at least look.
Mar 6 '12 #8

Post your reply

Sign in to post your reply or Sign up for a free account.