Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics SL (Archived)

Setting values of a control from one form to another

Posted on by 1,270

Hi

I am trying to set the value of a text box placed on the sales order form, that I refer to as the Permission number text box, to appear in the Manufacturer number text box which is in the the bin/lot/serial form. 

In other words, what I am trying to achieve is to have the same information in one text box to appear in another text box from a different form.

Any help would be appreciated if someone could point me in the right direction.

Thanks

Lisa

*This post is locked for comments

  • Suggested answer
    Apps Mexico Profile Picture
    Apps Mexico 1,090 on at
    RE: Setting values of a control from one form to another

    To set a value to other control you can use SetObjectValue or SetBufferValue. If the control is part of a grid you can use the MUpdate, MFirts, MNext functions.

    Example SetObjectValue:
    Dim sOrdNbr As String
    Dim sInvcDate As String
    Dim FechaSQL As Sdate

    Call GetBufferValue("bSOShipHeader.OrdNbr", sOrdNbr)
    Call GetBufferValue("bSOShipHeader.InvcDate", sInvcDate)

    FechaSQL.val = sInvcDate

    If FechaSQL.val = 0 Then
    Call GetSysDate(FechaSQL)
    sInvcDate = DateToStr(FechaSQL)
    Else
    sInvcDate = DateToStr(FechaSQL)
    End If

    If Trim(sOrdNbr) = "" Then
    serr2 = SetObjectValue("corddate_0", sInvcDate)
    Else
    serr2 = SetObjectValue("cdatecancelled_0", sInvcDate)
    End If

    Example SetBufferValue:
    Dim FechaSQL As Sdate
    Dim sFechaFactura As String

    Call GetBufferValue("bSOShipHeader.InvcDate", sFecha)

    If Trim(sFecha) = "" Then
    Call GetSysDate(FechaSQL)
    Else
    FechaSQL.val = sFecha
    End If
    sFecha = DateToStr(FechaSQL)

    Call SetBufferValue("bSOShipHeader.InvcDate", sFecha)

    Example Update Grid field:

    Private Sub ccustid_0_Chk(ChkStrg As String, retval As Integer)
    MH_xFECustContact_Row = MGetRowNum(MH_xFECustContact)
    serr1 = MFirst(MH_xFECustContact, MH_xFECustContact_Flag)
    Do Until serr1 = NOTFOUND
    Call ObtieneCamposLlave
    serr_xFECustContact = SqlFetch1(CSR_xFECustContact, "xsp_xFECustContact_All" & SParm(bxFECustContact.CustID) & SParm(bxFECustContact.ContactID), txFECustContact, LenB(txFECustContact))
    If serr_xFECustContact = 0 Then
    bxFECustContact.EnviarCfdi = txFECustContact.EnviarCfdi
    Call MUpdate(MH_xFECustContact)
    End If
    Call MUpdate(MH_xFECustContact)
    serr1 = MNext(MH_xFECustContact, MH_xFECustContact_Flag)
    Loop
    Call msetrownum(MH_xFECustContact, MH_xFECustContact_Row)
    Call MDisplay(MH_xFECustContact)
    End Sub

  • RayD Profile Picture
    RayD 235 on at
    RE: Setting values of a control from one form to another

    On the calling form use [forminstance].textbox.text =  me.textbox.text

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans