Wrox Programmer Forums
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 18th, 2007, 01:42 PM
Authorized User
 
Join Date: Apr 2007
Posts: 65
Thanks: 0
Thanked 0 Times in 0 Posts
Default Controls with NO UPDATE!

I am making a form, with the "Autonumber" and "User Name" as locked controls which cannot be changed when adding information to the form. The 'Autonumber' on the form is done when a command button on the frmMainForm is pressed saying 'New Task'. The users are also logging into the database with a user name and password.

What I am trying to do is:

1. Make the "autonumber" field locked so that it will not change if it is opened by someone else for editing.

2. Make the "user name" field populated by the person who ORIGINALLY started the task and will NOT be over-written by someone who opens it to be edited.

Is this possible?

 
Old April 18th, 2007, 08:56 PM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 217
Thanks: 0
Thanked 1 Time in 1 Post
Default

Bryan,
One way to do this: You could make the form unbound. Then, give the user a button to "Save" their entries. When the record saves, your autonumber field will increment and populate. You could also (at log in) take the user id or name and store it in a global variable. When you create the record for the first time, take the value of the variable and populate the User field.

HTH,

Loralee

 
Old April 18th, 2007, 10:20 PM
Authorized User
 
Join Date: Apr 2007
Posts: 65
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Loralee,

I am trying to make it so that when a user clicks "add new task" from the main switchboard, the "autonumber" for TaskID is put there automatically, shown to the user but they cannot change it. It stays constant.

The other thing that I am doing, because multiple people are going to be accessing the db to see, edit and perform further actions on the same tasks, is to make the "User Name" text box much like the "Task ID" text box. The first and ONLY the first time that the person who originally created the task, their db user name populates that field and it cannot be changed no matter how many times the task is opened, edited, or otherwise. It is a way to track who did what, should the task be 'lost' or misplaced.

 
Old April 19th, 2007, 06:24 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Hiya,

First and foremost, if the field is autonumber, then it can't be changed by a user. If you want to display it, it is only a matter of formatting. Open the properties dialog box on the autonumber text box, select the data tab, and select Enabled = No, Locked = Yes.

You can also do the same thing for the User Name text box.

The users may be able to open the tables, however, so you will have to set their properties to Hidden, but that is only for most users. Other people can figure that out.

Another method is to create four fields in your tables, call them DateCreated, datetime, Default Value Now()
WhoCreated,
DateModified,
WhoModified.

Then on the Before Insert event of the form, do this:

Me.WhoCreated = 'where ever you are storing the username

Then on the Before Update event, do this:

Me.DateModified = Now()
Me.WhoModified = 'where ever you are storing the username

Then put these text boxes on the forms, but set Visible to No.

Did that help any?



mmcdonal





Similar Threads
Thread Thread Starter Forum Replies Last Post
update multiple columns in an update statement debbiecoates SQL Server 2000 1 August 17th, 2008 04:01 AM
Subform Record Saved, Update/Requery Form controls CB-VTXer Access VBA 2 August 6th, 2007 02:35 PM
update the window controls even if a model window( maheep83 VS.NET 2002/2003 0 August 23rd, 2006 07:28 AM
Datagrid.update() and DataAdapter.Update aarunlal ASP.NET 2.0 Professional 2 February 23rd, 2006 11:41 PM
Bound Controls don't update SQL DB Ron Howerton ADO.NET 1 January 28th, 2004 03:46 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.