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.

  • 0 in reply to dingosoft

    This is in VB and the project includes a copy of the OE1100.ocx screen.  I use code to hide the POST button if the user is NOT on a user list built by the management.

    I don't use the User Security.  

    I think the OnRecordChanged will work but I'm not sure.  I'm going to try some of the suggestions from everyone.

    Thanks to everyone for your help.

    Dana

  • +1 in reply to Dana B. Stidsen
    verified answer

    I wanted everyone to know that I was able to get it working.  The code examples really helped. 

    Dana

Reply Children
No Data