Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

O/E Screen How to apply criteria on Customer Code finder using VBA Macros 1

Status
Not open for further replies.

Zahid H

Programmer
Feb 14, 2017
3
AE
O/E Screen:

There is a requirement from my customer to customize the finder pop-up on Customer. Below is the business rule:

1. Customers list are maintained based on users e.g. User A can not see User B customers and like wise.

So, I am thinking to give some SQL criteria based on the logged user before user clicks search button.

Any help in this regard would be highly appreciated.

attached herewith is the screen shot

pic_ohztxk.jpg




Thanks.
 
You'll have to customize the OE screen using VBA or VB. You can capture the button click event on the customer field and apply a filter to the finder to achieve what you need. You'll also need to adjust the finder on the order number field, too. And you'll need to capture the event when an order is loaded that the user is allowed to view that order. Even posting the order will prompt Sage to ask you if you want to print the confirmation so you'll need to make sure that they cannot print that. And you'll want to restrict exporting.

That's just the order entry screen. If that's all that they have access to then you should be good after that. If they have access to other areas of OE, like reports, you'll need to lock down finder customization and consider using customization directories so that user based filtering of data is a little easier to manage.

It seems like a simple request but there are so many ways to access that data that you need to take a step back to figure out how you'll lock it all down.


 
DjangMan, Thank you for your detailed response.

Let me explain to you the progress which has been made so far in the same context.

I have already created an OE Order Entry custom screen in VBA (Macro) using Accpac OCX and other controls and successfully applied different business logic on the new button like opening a DB connection, reading order items from data source control named "adsOEORDD".

Now the users want to have custom finder for Customer field named "afeOEORDHcustomer" in the customized OE Order Entry Screen.

Can you please provide with me some sample code for "How to capture/catch the search button on-click event" ?

Thanks.



 
You'll need to create a variable something like:
Code:
Dim WithEvents CustomerNumberField As AccpacFldEdit.AccpacFieldEditControl

Then you need to assign the customer number field in the UI to your control variable:
Code:
    Set CustomerNumberField = Me.AccpacUI.UIAppControls("afeOEORDHcustomer").GetControl

Now you will have events that you can react to the button click event and see if the user clicked the finder:

Code:
Private Sub CustomerNumberField _OnClickButton(ByVal btnType As AccpacFldEditCtl.tagButtonType, pStatus As AccpacFldEditCtl.tagButtonEventStatus)
    
    If btnType = BTN_FINDER Then
        CustomerNumberField.ViewFinder.Filter = " your filter here "
    End If

End Sub

Keep in mind that your filter must be supported by Sage. SQL won't work.


 
You have to add it to the Order number finder, too. And the shipment UI. And the invoice UI. And any reports. Face it, you're reinventing a big wheel. You're going to waste a lot of time and your customer's money, and there will still be security holes. Norming has a product already built.
 
Thank you DjangMan. Your solution really helped me to finalise the solution with customer.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top