have subform with 3 link fields to main form. would like to have a command button show subfrom when needed. tried command button to open form and control source link to those fields but would not enter said link fields into table subform is related to.
Hi not sure it this will help but maybe you need to add in the click event right before the
DoCmd.openform "Your sub form"
I would maybe think adding
DoCmd.close "The main form"
I am not sure if this will help at all. I can offer it as suggestion as I am just learning VB and all. Hope it helps for now till Better tech can reply.
This is kind of a sticky process. When you have a subform, Access resolves all of its data properties and compiles all the events for all the controls on it BEFORE it opens the main form. (I know, go figure... )
What you may need to do is make the subform invisible normally, and make it visible only when the command button "Show Subform" on your main form is clicked.
Rather than "opening" the subform, you're making it visible. It has to be OPEN for the main guy to load correctly, as far as I understand.
Remember, you're unique - just like everyone else
You're invited to visit another free Access forum:
thanks wwgmr I will explore.That would mean I would have to establish the form as a subform and under properties select not to have visiable then command to show subform?
I assume your question is directed at me. Yes. Set the visible property for the CONTROL you've slipped the subform into, to NO. There'll be a big blank gray box on your form, but the subform WILL be "open", so you can do what you want with it data-wise...Then when you want to, code a
Forms!{main form name}!{Control-Name}.FORM.VISIBLE = TRUE
eg
Forms!frmMain!ctlSubform.FORM.Visible = true
Remember, you're unique - just like everyone else
You're invited to visit another free Access forum:
That sounds right JimAtTheFAA, I still need to get use to how the object controls are worded in Office vrs Pure VBA. I think that should work well.
So in access the name of the form then .form is needed so it will see it for what it is. Then we use the .visable = no or yes vrs True or false correct?
so it would be as you typed it
formname.FORM.Visable = no 'which is the same as False right?
So in access the name of the form then .form is needed so it will see it for what it is. Then we use the .visable = no or yes vrs True or false correct?
Almost. The modifier BEFORE the word FORM is the name of the CONTROL your subform is in, not the name of the form itself. Let's run through the example again:
Mainform : frmMain
Subform : frmDetails
Control on FrmDetails: cboPickOne
Control on FrmMain that you stick frmDetails in: sfrmCtrl
To refer to the combo box on frmDetails, while you have frmMain active:
Me!sfrmCtrl.FORM!cboPickOne
To make the subform INVISIBLE:
Me!sfrmCtrl.Visible = False
Note that in this reference there is NO mention of the object "frmDetails", per se.
And I think you can use .Visible = NO - I've always just used TRUE/FALSE 'cause those are the choices that come up in the syntax picker...
Remember, you're unique - just like everyone else
You're invited to visit another free Access forum:
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.