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

  • 0

    That should be possible.  But Orchid Extender makes this stuff so much easier.

  • 0 in reply to Jay Converse Acumen

    I had thought about Extender but I have a lot invested in the VB program.  As near as I can tell this will be last change for this screen.

  • 0

    I'm not quite understanding - you should be able to react to that field changing (and to when the order is pulled up on the screen) to show/hide the post button. What have you tried so far?

    One option is to create your own Post Button that you have full control over and don't use the Customize UI functionality to hide the button. Move the existing Post button far to the left (like, -8000) and set it's TabStop to false. Then you can show/hide your own post button as required or run some logic in the click event and decide if you're going to set the value of the actual post button to 1 (to press it).

    And as of being the last change for this screen - that can apply until there is a version upgrade. Slight smile

    +1 for Extender, even if there are no more changes - deployment and not worrying how the customer opened up the OE screen is worth the price of admission.

  • 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