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