I want a button in a subform to trigger a label and text box to become visible in the main form. Isn't the code quite straightforward like below? It does not seem to work.
I have this working code in production, having a subform set focus back to itself:
Code:
'As this form is used within a subform control, necessary to setfocus
'to the subform control first, then the control itself which is on the subform form
Me.Parent.subform_quality.SetFocus
Me.fldid.SetFocus
Oh... and I seem to recall some syntax that for subforms it is necessary to put .Form. in the call syntax at sometimes... I will see if I have a use example of that call syntax... No hits, sorry.
Oh... and I seem to recall some syntax that for subforms it is necessary to put .Form. in the call syntax at sometimes... I will see if I have a use example of that call syntax... No hits, sorry.
When wanting to use any of the controls, methods, or properties of the actual subform, you must use.Form. to tell Access you are referring to the form and not the subform container control.
2 guesses: 1) AllForms!MainForm.ControlName.Visible = True this is how you modify an unloaded form, maybe good also for out-of-focus control.. 2) Me.Parent!ControlName.Visible = True
Oh... and I seem to recall some syntax that for subforms it is necessary to put .Form. in the call syntax at sometimes... I will see if I have a use example of that call syntax... No hits, sorry.
Helps to search the entire database and not just the current form!
Code:
'Populate the form fields from the attributes
MePointer.flduserid.Value = Me.userid
MePointer.fldusername.Value = Me.username
MePointer.fldactive.Value = Me.active
MePointer.fldemailaddy.Value = Me.emailaddy
[B] MePointer[COLOR=Red].child_subform_lastsaved.Form.[/COLOR]fldlastsaveusername.Value = Me.authusername
MePointer[COLOR=Red].child_subform_lastsaved.Form.[/COLOR]fldlastsavelogtimestamp.Value = Me.logtimestamp[/B]
So in this example, the Form code has passed a pointer to itself (Me) when it called the class method. The class method receives that pointer into variable ByRef MePointer. The code then populates Form controls, including a couple of fields which are on a subform of the calling Form.
That never worked, so I was convinced the syntax is not right. But from all the research, it just seems that simple, so I made the associated text box visible too with
I believe you may disconnect the Text Control from the Field Control, and then perhaps you could hide the Text Control separately. I missed the point that you were trying to hide a Text Control which was created with a Field Control.
The admin UI should be in the Grouping area of the Form editor which controls that.