VB6 Programming question regarding OnRecordChanged

SOLVED

Back on the custom OE Screen.  Here is what I need to do.  Currently the 'Post' button is hidden for certain users and exposed for others so they can post orders and quotes.

When the 'Order' is a 'Quote' ALL the users should have the 'Post' button available.  Only for quotes.

I thought maybe I'd use the OnRecordChange function but I need help with this.  I was hoping I could just focus on OrderType field being changed.  Is that possible?

Essentially, I want to track when the OrderType changes to 4 and reveal the 'Post' button.  If it changes back to 1 (Order) then hide the 'Post' button.

Any and all advice is greatly appreciated.

Dana

Parents
  • 0

    When you say "the 'Post' button is hidden for certain users and exposed for others" is that being done by the customisation or by the settings in Security Groups?

    If it's a setting in security, then unhiding the button isn't enough to allow them to post. They will just get an error message from the view when they click the button.

    If it's your customisation that's hiding the button for certain users then you would normally use OnRecordChanged for when the order Type field is changed as well as OnKeyChanged for when they initially open the order or scroll to another order etc. But I'm pretty sure a key change also triggers OnRecordChanged, so you could probably get away with just using OnRecordChanged.

    In OnRecordChanged you could try something like:

    Private Sub adsOEORDH_OnRecordChanged(ByVal eReason As AccpacCOMAPI.tagEventReason, ByVal pField As AccpacDataSrcCtl.IAccpacDSField, ByVal pMultipleFields As AccpacDataSrcCtl.IAccpacDSFields)

    Select Case pField.Name
    Case "ORDUNIQ", "TYPE"
        if adsOEORDH.Fields("TYPE").Value = 4 then

            mAppControls("APP_Save_Button").UIVisibleFlag = True

        else

            if (the post button should be hidden for this user) then

                 mAppControls("APP_Save_Button").UIVisibleFlag = False

            End If

        End If


    End Select

    At least, that's what it wold look like in a regular VB screen. I don't know if it is different in a customisation screen.

Reply
  • 0

    When you say "the 'Post' button is hidden for certain users and exposed for others" is that being done by the customisation or by the settings in Security Groups?

    If it's a setting in security, then unhiding the button isn't enough to allow them to post. They will just get an error message from the view when they click the button.

    If it's your customisation that's hiding the button for certain users then you would normally use OnRecordChanged for when the order Type field is changed as well as OnKeyChanged for when they initially open the order or scroll to another order etc. But I'm pretty sure a key change also triggers OnRecordChanged, so you could probably get away with just using OnRecordChanged.

    In OnRecordChanged you could try something like:

    Private Sub adsOEORDH_OnRecordChanged(ByVal eReason As AccpacCOMAPI.tagEventReason, ByVal pField As AccpacDataSrcCtl.IAccpacDSField, ByVal pMultipleFields As AccpacDataSrcCtl.IAccpacDSFields)

    Select Case pField.Name
    Case "ORDUNIQ", "TYPE"
        if adsOEORDH.Fields("TYPE").Value = 4 then

            mAppControls("APP_Save_Button").UIVisibleFlag = True

        else

            if (the post button should be hidden for this user) then

                 mAppControls("APP_Save_Button").UIVisibleFlag = False

            End If

        End If


    End Select

    At least, that's what it wold look like in a regular VB screen. I don't know if it is different in a customisation screen.

Children