Avatar of darwin02
 asked on

set value for textfield in a adp project

It is the first time I use an adp project (access 2003 front-end and sql server 2000) and I have a lot of suprises, because things I normaly did in Access, does not work anymore :

eg In the OnOpen event of a form, I regulary set the value for a textfield on the form
say txtfield (bound to a table) is txtUserName.
Then I set this as follows:
Me.txtUserName = gbl_UserName  
(where gbl_UserName is a global that is initiated at start-up)
Me.txtUserName = "Bill"
This to avoid that users need to enter this value.
When I try this in my adp project, I get an errror "you can't assign a value to this object....."

I would be very pleased if someone could tell me how I can solve this problem.

Microsoft AccessMicrosoft SQL Server

Avatar of undefined
Last Comment

8/22/2022 - Mon
Scott McDaniel (EE MVE )

Perhaps your form, or the table/query driving the form, are not updateable? What did you base this form on? IN SQL Server, all tables must have a Primary Key in order to be updateable ...

The form is based on a table that has a primary key:
FunctioID of typ Unique Identifier, a foreign key PlantID, FunctionDescription and four fields CreationUser, CreationDate, ModifUser and Modif Date.
Actually, I want via the form that the user only need to fill out the FunctionDescription, and set automatically the other fields.
Because  PlantID is different for people of different plants, I cannot use the default value in the table, and also the CreationUser is changing of course.
Because these values are set on login through global variables in my access front-end, I wanted these to put in the fields of the form.  And there it goes wrong......            

View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy