Hi
I have Main Form & Sub Form . Main Form Source Table is Location & Sub Form is Sale Line Table. I have below code to filter record according to User Id Location . It should display only 1 record according to User Location . User should not be able to select any other Location. User should not be able to select Previous , Next buttons.
IF UserSetup.GET(USERID) THEN
BEGIN
UserSetup.TESTFIELD("Store No.");
IF (UserMgt.GetUserInfo2(USERID) <> '' )THEN BEGIN
SETRANGE("No.",UserMgt.GetUserInfo2(USERID));
END;
END;
Thanks
*This post is locked for comments
Hi
When i set the property Insert Allowed = No of Main Source table then it is working.
Thanks
Looking at the code, If User Setup will not exist for user he/she can able to view all record.
Please check the user setup for user you are in.
Hi
I have tried that but still it display 1 more record .
How FilterGroup(2),FilterGroup(1) works.
IF UserSetup.GET(USERID) THEN
BEGIN
UserSetup.TESTFIELD("Location");
IF (UserMgt.GetUserInfo2(USERID) <> '' )THEN BEGIN
FILTERGROUP(2);
SETRANGE("No.",UserMgt.GetUserInfo2(USERID));
FILTERGROUP(0);
END;
END;
//FILTERGROUP(2);
Thanks
Remove your last statement FILTERGROUP(2).
Hi
I have put it here but same issue. When i press Next Button it displays one blank record
Form - OnOpenForm()
IF UserSetup.GET(USERID) THEN
BEGIN
UserSetup.TESTFIELD("location");
IF (UserMgt.GetUserInfo2(USERID) <> '' )THEN BEGIN
FILTERGROUP(2);
SETRANGE("No.",UserMgt.GetUserInfo2(USERID));
FILTERGROUP(0);
END;
END;
FILTERGROUP(2);
Put it on Open Page.
Hi
Form - OnInit()
Thanks
Which trigger are you putting your code?
Hi Amol
I have added the screenshot
Thanks
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,219 Super User 2024 Season 2
Martin Dráb 230,056 Most Valuable Professional
nmaenpaa 101,156