I use the "run macro at start up" facility to automate the opening of the database and to configure certain options when a user fires up the client. I now want to switch to a particular profile based on the user's id (i.e. the profile name and user name are the same) - so that I can tailor what they are allowed to do and also record who last updated a record. I know the user could do this manually but would prefer to automate if at all possible. However, if there is no specific profile set up for a user, I want them to just use the "Default" profile.
The attributes/methods currently available allow me to determine the active profile (Database.Profile) or to set a different one (Database.SetProfile(xxx)) but not to discover what profiles have been defined. If the profile doesn't exist, SetProfile() causes Cardbox to raise an error message and the macro stops executing at that point. I tried setting an error handler (as much as this is possible in VBS) but this is not triggered because the macro is terminated first!
I do not want to hard code a lookup table in the macro. I suppose I could create a separate database that lists users who have a specific profile but that is just duplicating the list of profiles.
So, is there a way of either:
a) Discovering what profiles have been defined?
b) Getting Cardbox to recognise and transfer control to an error handling routine in the macro?
If anyone has an answer/suggestion, thanks in advance!