Results 1 to 3 of 3
  1. #1
    Join Date
    May 2004
    Posts
    133

    Wink Unanswered: .requery question

    I have two simple questions:

    1) Force a control in the subform of mainform to recaculate:
    I have a mainform named "products" and 04 subforms inside named:
    "InventorySubform" subform of the table "Inventory summary"
    "SubDelivery" subform of the table "delivery control"
    "Stockout Subform" subform of the table "stockout"
    "currentremainedSubform" form of the query "currentremained"

    The "InventorySubform" subform have a coltrol named:"initialstock"
    The "SubDelivery" subform have a coltrol named:"shiped"
    The "Stockout Subform" subform have a coltrol named:"out"
    The "currentremainedSubform" subform have a coltrol named:"remained"

    The control "remained" is using the formula: =initialstock+shiped-out
    They works exactly with no problem. But when I modified the value in
    "InventorySubform" or in "Stockout Subform" or in "SubDelivery", they
    don't recaculate immediately (i mean they don't recaculate with real-time effect)

    I already tried ".requery" in the afterupdate event in those subform's controls like this:
    Forms!products!currentremainedSubform.Form!Remaine d.requery
    But above code don't work.
    Could any one give me a trick on this issue?

    2) Print diallog:
    I always use the print command buttont wizard to create print button for access form.
    If I press it, it give me the action of printing current record or all records.
    But I want to use the print dialog of windows.
    (I mean: for example, In microsoft word or excel, if you press ctrl+P, a print dialog of windows appear, I want to use it)
    Could anyone give me a code to be able to use that print dialog in my form?
    many thanks.

  2. #2
    Join Date
    Nov 2003
    Posts
    1,487
    Here are some samples for reading and writing to and from a SubForm
    from a Parent Form......

    Requery a SubForm from a parent Form:

    Forms![ParentFormName]![SubFormName].Requery
    __________________________________________________ __________________


    Read the Value of a Control within a SubFrom
    from the Parent Form:

    myVariable = Forms![ParentFormName]![SubFormName]![ControlNameInSubForm]
    __________________________________________________ __________________


    Set the value of a Control located in a SubForm
    from the Parent Form:

    Forms![ParentFormName]![SubFormName]![ControlNameInSubForm] = myVariable
    __________________________________________________ __________________


    Call a Function or Sub Procedure contained within
    a SubForm from the Parent form:

    Forms!ParentFormName![SubFormName].Form.YourFunctionOrProcedureName
    __________________________________________________ __________________


    To fire (run) an event for a Control that located within a
    SubForm from the Parent Form:

    Forms!ParentFormName![SubFormName].Form.ControlNameInSubForm_Click
    __________________________________________________ __________________

    Set Focus to a SubForm from the Parent Form:

    Forms!ParentFormName.SubFormName.SetFocus
    __________________________________________________ __________________


    Set a Property of a SubForm Control (the SubForm Control Itself)
    from the Parent Form:

    Forms!ParentFormName!SubFormName.Locked = True
    __________________________________________________ __________________
    __________________________________________________ __________________


    To display the Print dialog box from code, use this little routine:
    Code:
    On Error Resume Next
    DoCmd.RunCommand acCmdPrint
    If Err = 2501 Then
    MsgBox "Print was Canceled."
    End If

  3. #3
    Join Date
    May 2004
    Posts
    133
    thank for the help. I'll try it now.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •