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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sub form visable 1

Status
Not open for further replies.

end922

Technical User
Apr 17, 2007
59
US
Hello,
I am working with a main form with several subforms. Upon open of the main form the sub forms are set to visable = false. I have a command button that make a particular form visable when clicked. Only 1 form at a time. After updating the form I want to save and close with a command button on click and make that form visable = false. That's where I get hung up.

frmBorrower is main form.
subfrmbilling is sub form.
subfrmdisb is sub form.

Thanks
eric
 
Are you having a problem with setting the visible property? Where are you running the code to save and set visible to false? That is, what form and what event?
 
How are ya end922 . . .

Also . . . after you save you need to move the focus off the subform if you intend to hide it again! [purple]You can't hide a control while it has the focus! . . .[/purple]

[blue]Your Thoughts? . . .[/blue]

Calvin.gif
See Ya! . . . . . .
 
Remou,

I was having problems. I moved the cmd button from the subfrm to the main form and set the focus there. Now I can't get my macro to run. Any help on this would be appreciated.
Thanks


Private Sub cmdsave_Click()

Dim billsave As String
billsave = mcrobilling

DoCmd.RunMacro billsave

Me.txtassignedto.SetFocus

subfrmbilling.Visible = False
subfrmbilling.Enabled = False

Exit Sub

End Sub
 
It seems that the macro needs the focus to be set to the subform before it will work. Alternatively, you could move the macro back to the subform and move the focus before you change the visible property:

[tt]Me.Parent.NameOfAControlOnTheMainForm.SetFocus
Me.Visible = False[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top