Search code examples
ms-accessvbams-access-2010

Opening a zoom window in MS Access


I am having an issue with opening a zoom window in a sub form.

Basically, I have created a pop up window (form) which is suppose to appear upon double clicking in a memo field in a sub form to allow the user to be able to zoom in on the field and have additional ease upon entering long sentences.

I believe the problem is linked to the fact that the form which I am trying to create the zoom window is actually a sub form embedded in a form. My reasoning behind this is due to the fact that my code works perfectly well when i open the sub form alone and double click on the zoom in field..

Below is the code. The subform name is 'frmMasterListOfEventsDetails", the control / field to zoom in on in the sub form is called "notes2". The pop up window (subform) is named "frmZoom" and its control (text box) where the information is to be entered is called "txtZoom".

I would appreciate any help you may have. Thank you

Private Sub Notes2_DblClick(Cancel As Integer)
    If Me.AllowEdits = False Then
        Messaggi.MessaggioExclamation
    Else
        Me.Refresh
        DoCmd.OpenForm "frmzoom", acNormal, , , , acDialog
    End If

End Sub


Private Sub Form_Close()
    Forms("frmMasterListOfEventsDetails")!Notes2 = Me.txtZoom
    Forms("frmMasterListOfEventsDetails").Refresh

End Sub

Private Sub Form_Open(Cancel As Integer)
    Me.txtZoom = Forms("frmMasterListOfEventsDetails")!Notes2
End Sub

Solution

  • I believe the problem is linked to the fact that the form which I am trying to create the zoom window is actually a sub form embedded in a form

    I believe you are correct. Since frmMasterListOfEventsDetails is a subform,

    Forms("frmMasterListOfEventsDetails") 
    

    will not find it. You need to go through the main form:

    Forms("parentFormName").Form.frmMasterListOfEventsDetails.Form.Notes2 = Me.txtZoom