I have a "master" form which contains a few subforms that are shown or hidden depending on the context of the master form (which options are selected, etc.).
In one subform, the user enters audit information. I attempting to make the AfterUpdate subroutine set on that subform to hide itself and show another subform. There is a button on the master form that does just this, but I want it to do it automatically when the user updates the record. I just can't seem to get it to work, though.
Me.Parent.cmdPostClosingMemo_Click looks like this:Dim Resp As Variant If Not IsNull(Me.Date_of_Doc_Audit) And Not Me.Post_Closing_Memo_Sent Then Resp = MsgBox("Were there Post Closing Exceptions?", vbYesNoCancel, "Post Closing Memo") Select Case Resp Case vbYes Call Me.Parent.cmdPostClosingMemo_Click Case vbNo Case vbCancel End Select End If
The cmdPostClosingMemo_Click subroutine runs, because the lblTitle lable changes, but the subforms do not hide/unhide.Public Sub cmdPostClosingMemo_Click() Me.lblTitle.Caption = "Post Closing Exceptions" Me.frmDocumentation_sub.Visible = False Me.frmInsuranceException_sub.Visible = False Me.frmDocException_sub.Visible = False Me.frmTaxException_sub.Visible = False Me.frmPostClosingMemo_Sub.Visible = True Me.frmPostClosingMemo_Sub![Date of Memo].ColumnWidth = -2 Me.frmPostClosingMemo_Sub![Document 1 Type].ColumnWidth = -2 Me.frmPostClosingMemo_Sub![Term on Document 1].ColumnWidth = -2 Me.frmPostClosingMemo_Sub![Document 2 Type].ColumnWidth = -2 Me.frmPostClosingMemo_Sub![Term on Document 2].ColumnWidth = -2 End Sub
I've played around with the syntax, done oodles of Google searches, etc. Can someone help me out?
I'm not too familiar with the use of subforms, but does it work if you set the focus on the PostClosingMemo subform first?
Is there an error, or does it just not do what you want it to?
Is your code running too slowly?
Does your workbook or database have a bunch of duplicate pieces of data?
Have a look at this article to learn the best ways to set up your projects.
It will save both time and effort in the long run!
Dave
Me.Parent.SetFocus does not work. Neither does Me.Parent.cmdPostClosingMemo.SetFocus. It changes the lblTitle.Caption, but just doers not hide/unhide the subforms.
Looking at this site (http://access.mvps.org/access/forms/frm0031.htm) I am thinking maybe it is not possible to control a subform from another subform. The "To refer to a subform control property, like SourceObject" section has N/A if you are on the parent form or any subform. If this is the case, I can't imagine what the reason is. Should I SetFocus on another for briefly and have that form's "SetFocus" event do the work?
Can you just avoid the descendant issue by jumping to the form by name?:
The subform would have to be visible before you can set the focus.[Forms]!["Parent"_Form].[frmPostClosingMemo_Sub].SetFocus
Is your code running too slowly?
Does your workbook or database have a bunch of duplicate pieces of data?
Have a look at this article to learn the best ways to set up your projects.
It will save both time and effort in the long run!
Dave
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks