>I need a view based on the user which is currently logged in my app. I have set a global variable containing this user's ID.
>
>Can I use the content of this global variable as in:
>Select * ;
> from MyTable ;
> where MyTbale.User_Id = MyGlobalVariable'sContent
>
>What would be the correct syntax for the where portion of the statement so that I could extract the content of the variable ?
>
>TIA
>
To be more complete, create a parameterized view. The View Designer would produce code like:
Create SQL View v_MyTable as ;
Select * ;
from MyTable ;
where MyTbale.User_Id = ?nUser_ID
Then all you need to do:
use v_Mytable nodata * this can be in the Form DE with NoDataOnLoad = .T.
local nUser_ID
nUser_ID = oApp.User_ID
* I create an Application object to store all kinds of stuff,
* one of which is a User_ID property to store the ID value
* of the Employee currently logged in
requery("v_Mytable")
If you put the view in the form DE, put SET TALK OFF in the BeforeOpenTables
Mark McCasland
Midlothian, TX USA