Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting form caption on first run

Status
Not open for further replies.

raymondo

Technical User
May 3, 2002
86
AU
I have a DB where the frontend is installed on users' PCs. What I would like to do when the user runs the DB for the first time, is have all the form caption fields set to the user's department name - which they type in the first time only.
At the moment I have the OnActivate event for each form do this but is there a way to set it permanently on the first run?
Many thanks
 
Raymond,

There are a couple of ways to handle this. The assumption I am going under is you want this situation to occur the first time the user starts the application, and if they start the application ten times in one day the sequence of events will happen exactly ten times.

This method assumes you have implemented Access Security. Every group name is a department name, and every member of a department is assigned to the group with his/her department name.

In a global module you associate a bit flag with each form.

Almost always, my startup routine opens a small unbound form hidden. It is the open event of that form which controls all of my housekeeping and setup routines. From this form you would set all form bit flags to false, get the users group name, and whatever else you might need to do.

The last thing this event does is open the menu which the user is going to see. In the open event of this and every form, you check the status of its associated bit flag. If the flag is false, you stuff the group name (department) into the forms caption, and you turn the bit on, so the next time the form is opened, the caption will be its original value.

You can use that hidden forms unload event to do all kinds of close down routines, the least of which is to be sure you really want the user to end his session or not.
Robert Berman
Data Base consultant
Vulcan Software Services
thornmastr@yahoo.com
 
Robert,
Thanks for your input. I like the idea of the form handling housekeeping and I do have security implemented so it should work nicely. Actually the main user menu form does some housekeeping already on opening but I hadn't thought of the shutdown possibilities nor about using bit flags.
Do you know if it is possible to use DAO or ADO to permanently change the properties of a form - as you can change, for example, table properties? It doesn't appear possible using ADO as forms do not make up part of the ADOX catalog of objects and I know very little about DAO!
Raymondo
raymondo@rossar.net
 

Raymondo,

The good news is you can permanently change form properties, but I don’t do it…ever… for one simple reason. You have to be the only user of the database and you have to open the form in design mode. So, yes you can, but do you really want to take the risk???????

Interesting….You don’t know too much about DAO and that is my category with ADO, but I finally found the cure. I’ve always wanted to work with ADO simply because it is there, so now what I do is I write one function in DAO and the next in ADO. Eventually I’ll be ambilinguistic. SNORT.
Robert Berman
Data Base consultant
Vulcan Software Services
thornmastr@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top