How are users "assigned a HotelID"?
Do the records you want to restrict also have this same HotelID or are related to a record that does?
Need that info in order to suggest some Record Level Access expressions that will work for you.
Does this layout mean you have a table where each user has a record with fields for HotelID and Account Name?
If you want to restrict a user to only records with their HotelID, you can do this:
Define a global variable for storing the user's HotelID. I'll call it gUserHotelID.
Set this script to run when the file opens (subsitute your actual field, table and layout names for mine):
Go To Layout [Report1 ]//I think that's the layout you just posted any layout that refers to this table will suffice
Enter Find Mode
Set Field [Report1::LogIn ; get ( AccountName ) ]
Set Error capture [on]
If [Get ( foundcount ) = 1 ]
Set Field [YourTable::gUserHotelID; value: Report1::hotelID]
Go To Layout[//specify layout where you want your users to start working with the database]
Go To Layout [//specify a layout for this error condition. There's an error in your table, either no record for this account or more than one]
Show Custom Dialog ["Error with account records"]
Now, any table with a field that stores the HotelID can be restricted in Manage | Security with this expression:
YourTable::gHotelID = HotelIDField
If it is related to a table that stores a HotelID, you can use this expression:
YourTable::gHotelId = RelatedTable::HotelIDField
Thank you VERY much.....
One more thing:
Now that you have magically fixed my access issue.
Can you give me advice on one more thing regarding this script.
Now that the script recongnizes the user when the layout is accessed, If I wanted to have a couple of fields in (Report1) pre-populate with the (HotelID) and (HotelName) when a NEW RECORD is created by this user.
How would I do that?
Check out the auto enter field options for Looked up Value and calculation. One or both of those two options should be something that you can use for this.