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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Saving Changes on a Form thru code

Status
Not open for further replies.

batteam

Programmer
Sep 12, 2003
374
US
I have a Form that, on the Load event, changes a label caption from "Production" to "Blank". I then want to be sure that change is saved when the Form is closed by the user. To do that, I am using: DoCmd.Save acform, "FormName" right after I change the label caption, even using "Me.Repaint" first, but the change in the label caption is not saved - I can verify this by checking the label caption when looking at the form in Design View - it still is "Production". Any ideas on why this is not working and what other way there would be to save changes on the form when its closed? Thanks for any help you can provide.
 

From my experience the only way to save data is in a table. You could create a small table that holds the caption and retrieve it when the form is re-opened.


Randy
 
Thanks. This application has multiple users and we are sharing tables thru SQL, but using your idea, I can create a small form with a field on it then have the main form read that field on load, then change it then close it. That would serve the same purpose as a small table.

Thanks.
 
Actually, that won't work either; same problem. Maybe I can have code delete a tiny, blank form on load then check for its existence if the user opens the db up in an improper way the next time around.
 

Because I'm curious...
Why do you not want to store data in a table?


Randy
 
Its not that I don't want to store data in a table. The reason I can't do that for this problem is that we're using SQL shared tables and there's multiple users on the application. I need a way to test each individual user at log on time to see if they logged on thru the correct path. If they did, I need a way to indicate that so if they don't the next morning, they will get an error message. Using a shared table to store a 1 or 0 for what an individual user did doesn't work. Unless of course, I created a record for each user in the table. And that is an option, but we're on a big production server and making a new table(s) and R/W sp's, etc. is a little more than we'd like to do for this situation, especially since I think I found a way to solve the problem using a tiny form. That form stays with our production version; when our user's sign into the application, we actually COPY that production version to the indivdiual's drive on our server. That way, he/she is using their own copy of the app. Once the user opens the main form, the little hidden form that got copied over with the proudction version is deleted. Now, if the next morning, that same user logs on to the app by going directly to his individual drive on the server, code behind the main form will look for that form and it won't be there - cause it was deleted the day before. An error message will then tell the user to log on correctly, etc. etc. Bottom line is each user will have to user our procedures to copy the production version or they won't be able to log on.

I'm sure this is way more than you needed to know, but typing it all out like this sort of clearifies the logic in my own mind.

Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top