Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Need advices on passing tabbed subform name and control name to fMiniCalendar

Discussion in 'Information Technology' started by Bon, Jul 28, 2006.

  1. Bon

    Bon
    Expand Collapse
    Guest

    Hello all

    I have a fMiniCalendar module. If I click the calendar icon, it will
    pop-up Mini Calendar.

    When the fMiniCalendar is triggered, it will returns the date into a
    textbox on the form. This works fine when the form is a parent
    (frmMain). But, i got an error "The form/subform cannot be found" if I
    put the calendar icon in the tabbed subform (frm_screenpart).

    The command button code i tried to refer a control in tabbed subform:
    Call fMiniCalendar(, , "frmMain!frm_screenpart", "DOB")

    Where frmMain is the parent form, frm_screenpart is the subform in
    frmMain and DOB is the text field on the tabbed subform frm_screenpart
    that the returned date value goes.

    Under debug mode, the error stops at this line:
    Forms(FormName)(FieldName) = CombinedDate

    How can i make it work? Please give me some advices.

    Thanks

    Bon
     
  2. Loading...

    Similar Threads Forum Date
    Sikh News WWI Sikh Heroes Need To Be Remembered: Dr Atamjit Breaking News Sep 11, 2016
    Interracial And Interfaith Marriage, Help Needed To Confront/convince My Parents Love & Marriage Aug 16, 2016
    Sikh News Sikh Seva Volunteers Keep The Food Service Drive For The Needy Going After Passing Away Of Breaking News Jul 29, 2016
    Need some info regarding bibek wrt eating Sikh Rehat Maryada Jan 14, 2016
    Spiritual Why We Only Need To Pray For Naam Blogs Dec 20, 2015

  3. Brendan Reynolds

    Brendan Reynolds
    Expand Collapse
    Guest

    Here are two examples. The first procedure takes the name of the form, the
    name of the subform control, and the name of the text box as strings. The
    second example takes a single argument, a reference to the text box. Because
    this is a reference to the original text box, we can simply assign a value
    to the reference in order to have that value displayed in the text box, we
    do not need to know anything about the form that contains the text box.

    Public Sub Test1(ByVal FormName As String, _
    ByVal SubformControlName As String, _
    ByVal TextboxName As String)

    Dim frm As Form
    Dim sfr As SubForm
    Dim txtTest As TextBox

    Set frm = Forms(FormName)
    Set sfr = frm.Controls(SubformControlName)
    Set txtTest = sfr.Form.Controls(TextboxName)
    txtTest.Value = Date

    End Sub

    Public Sub Test2(MyTextBox As TextBox)

    MyTextBox.Value = Date

    End Sub

    Here are examples that show how to call each of the two procedures above.
    Here, 'sfrTest' is the name of the subform control. Don't forget that the
    name of the control may not be the same as the name of the form that it
    contains.

    Private Sub Command1_Click()

    Test1 Me.Name, "sfrTest", "txtTest"

    End Sub

    Private Sub Command2_Click()

    Test2 Me.sfrTest.Form.Controls("txtTest")

    End Sub

    --
    Brendan Reynolds
    Access MVP

    "Bon" <bonnie.tangyn@gmail.com> wrote in message
    news:1149007123.072162.56290@j55g2000cwa.googlegroups.com...
    > Hello all
    >
    > I have a fMiniCalendar module. If I click the calendar icon, it will
    > pop-up Mini Calendar.
    >
    > When the fMiniCalendar is triggered, it will returns the date into a
    > textbox on the form. This works fine when the form is a parent
    > (frmMain). But, i got an error "The form/subform cannot be found" if I
    > put the calendar icon in the tabbed subform (frm_screenpart).
    >
    > The command button code i tried to refer a control in tabbed subform:
    > Call fMiniCalendar(, , "frmMain!frm_screenpart", "DOB")
    >
    > Where frmMain is the parent form, frm_screenpart is the subform in
    > frmMain and DOB is the text field on the tabbed subform frm_screenpart
    > that the returned date value goes.
    >
    > Under debug mode, the error stops at this line:
    > Forms(FormName)(FieldName) = CombinedDate
    >
    > How can i make it work? Please give me some advices.
    >
    > Thanks
    >
    > Bon
    >
     
  4. SusanV

    SusanV
    Expand Collapse
    Guest

    Hi Bon,

    Here's a couple of good links on referencing parent forms, subforms and
    their controls:
    http://www.mvps.org/access/forms/frm0031.htm
    http://cma.zdnet.com/book/masteringaccess/aba13fi.htm#I106

    --
    hth,
    SusanV


    "Bon" <bonnie.tangyn@gmail.com> wrote in message
    news:1149007123.072162.56290@j55g2000cwa.googlegroups.com...
    > Hello all
    >
    > I have a fMiniCalendar module. If I click the calendar icon, it will
    > pop-up Mini Calendar.
    >
    > When the fMiniCalendar is triggered, it will returns the date into a
    > textbox on the form. This works fine when the form is a parent
    > (frmMain). But, i got an error "The form/subform cannot be found" if I
    > put the calendar icon in the tabbed subform (frm_screenpart).
    >
    > The command button code i tried to refer a control in tabbed subform:
    > Call fMiniCalendar(, , "frmMain!frm_screenpart", "DOB")
    >
    > Where frmMain is the parent form, frm_screenpart is the subform in
    > frmMain and DOB is the text field on the tabbed subform frm_screenpart
    > that the returned date value goes.
    >
    > Under debug mode, the error stops at this line:
    > Forms(FormName)(FieldName) = CombinedDate
    >
    > How can i make it work? Please give me some advices.
    >
    > Thanks
    >
    > Bon
    >
     

Share This Page