I have written an app that basically has many forms, one of which is a main menu.
Depending on users access rights, I need to open a form with the database components as either READ ONLY or READ/WRITE. ie. Add,Delete, Edit etc. options/buttons are unavailable or available depending on users rights.
From the main menu, I access the user's login id, and check their access rights, if they are able to access the form, it opens with the appropriate buttons enabled/disabled.
My problem is how do I pass a value to the form, and then where do add the code so that when the form opens, it uses this value to enable/disable the buttons.
I tried the following code which worked one minute, I believe it was when the code was used with the OnCreate Event of the Form, but doesn't work when attached to the OnShow Event.
Main Menu Code - Calls Form1
Access_FA = 1; // Full Access
Access_RW = 2; // Read Write
Access_RO = 3; // Read Only
Access_NO = 99; // No Access
Form1.Tag:=axsType; // axsType is assigned a Constant Value
procedure TForm1.FormShow(Sender: TObject);
var i: Integer;
case i of
1,2:IsOK:=True; // If true Enable Buttons
else IsOK:=False; // If False Disable Buttons
Any help would be appreciated.