default user code in form

R

Ricoy-Chicago

Users have to log-in into the LAN via their UserName and password.
I have a front-end database with coding that identifies the UserName, no
problem here.
I have a form based on a query and each time a new record is added, the user
has to enter his/her staff code in the [StaffCode] field. I know what the
staff code is based on their UserName.

I have been able to put a textbox that displays the correct staff code data
but ...

Question: How can i assign the staff code data to go into the [staffCode]
field without the user typing it? Am i using the wrong approach?

thanx.
 
A

Albert D.Kallal

You can get the current network logon name with:

http://www.mvps.org/access/api/api0008.htm

And, the current computer name with:

http://www.mvps.org/access/api/api0009.htm

And, if using ms-access security, then currentuser() will return the
ms-access logon.

I often log all 3 of the above values in some applications.

So, just place a control on the form (your contorl that will hold username),
and set the default to the first function from above

=fosUserName()
 
R

Ricoy-Chicago

I have no problem capturing the logon name.
Each staff member enter records into the master database.
Via their staff code, reports can be generated to keep track of their records.
No problems here so far.

When they enter the information for a new record, they have to type their
staff code, is there a way they don't have to type it? that it will show
automatically and to be saved along with the record they entering?
 
D

Douglas J Steele

What is their "staff code" (or, more relevantly, can you determine it
without them having to provide it)?

If you know what it is, you can always put logic in the form's BeforeUpdate
event to set the value in the table.
 
R

Ricoy-Chicago

A user logs-on as "Joe Smith" into the LAN.
The front-end database recognizes "Joe Smith" and assigns the
[StaffCode]="joe"
No problem here.
A data entry screen is used by all six staff members, this screen is based
on a query. They have to type their [StaffCode]. For example, Joe Smith has
to type "joe" in the [StaffCode] field.
Question: How can the form assign the value to the [StaffCode] automatically
and this value be part of the record?
 
D

Douglas J Steele

You really haven't answered my question.

Are you saying that any one of six different people can be using the same
machine, so that you don't know which of the 6 is currently on the machine?
Or have you got the (more normal) situation where each person logs onto the
machine, does his/her work, then logs off the machine? In other words, at
any point in time, is knowing the current network id enough to tell you the
staff code?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Ricoy-Chicago said:
A user logs-on as "Joe Smith" into the LAN.
The front-end database recognizes "Joe Smith" and assigns the
[StaffCode]="joe"
No problem here.
A data entry screen is used by all six staff members, this screen is based
on a query. They have to type their [StaffCode]. For example, Joe Smith has
to type "joe" in the [StaffCode] field.
Question: How can the form assign the value to the [StaffCode] automatically
and this value be part of the record?

Douglas J Steele said:
What is their "staff code" (or, more relevantly, can you determine it
without them having to provide it)?

If you know what it is, you can always put logic in the form's BeforeUpdate
event to set the value in the table.
 
R

Ricoy-Chicago

Each user has his/her own computer. At any given time the six of them maybe
entering data into the master file. Yes, the current network id is enough to
tell me the staff code. I have no problem here.

The data entry form is based on three tables: [StaffInformation] - it
contains the [StaffCode] field. [CustomerInformation] and [Invoices]

Everything works, except my boss asked if the staff does really have to type
their [StaffCode].

Currently, they have to type their code because the form is based on the
query. If I set the [StaffCode] field value to the value given by the Network
ID, still it does not displays the value in the form, this value is used to
run the query, instead... argh...
Can i set the property "default value" using coding? I f i do it, is it
going to change the value on all the records or only on the new ones that are
being typed?
I almost giving up and let the users type their codes...
I may check this newsgroup until tomorrow, time to go home... Thanks...


Douglas J Steele said:
You really haven't answered my question.

Are you saying that any one of six different people can be using the same
machine, so that you don't know which of the 6 is currently on the machine?
Or have you got the (more normal) situation where each person logs onto the
machine, does his/her work, then logs off the machine? In other words, at
any point in time, is knowing the current network id enough to tell you the
staff code?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Ricoy-Chicago said:
A user logs-on as "Joe Smith" into the LAN.
The front-end database recognizes "Joe Smith" and assigns the
[StaffCode]="joe"
No problem here.
A data entry screen is used by all six staff members, this screen is based
on a query. They have to type their [StaffCode]. For example, Joe Smith has
to type "joe" in the [StaffCode] field.
Question: How can the form assign the value to the [StaffCode] automatically
and this value be part of the record?

Douglas J Steele said:
What is their "staff code" (or, more relevantly, can you determine it
without them having to provide it)?

If you know what it is, you can always put logic in the form's BeforeUpdate
event to set the value in the table.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


I have no problem capturing the logon name.
Each staff member enter records into the master database.
Via their staff code, reports can be generated to keep track of their
records.
No problems here so far.

When they enter the information for a new record, they have to type their
staff code, is there a way they don't have to type it? that it will show
automatically and to be saved along with the record they entering?

:

You can get the current network logon name with:

http://www.mvps.org/access/api/api0008.htm

And, the current computer name with:

http://www.mvps.org/access/api/api0009.htm

And, if using ms-access security, then currentuser() will return the
ms-access logon.

I often log all 3 of the above values in some applications.

So, just place a control on the form (your contorl that will hold
username),
and set the default to the first function from above

=fosUserName()

--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
[email protected]
http://www.members.shaw.ca/AlbertKallal
 
D

Douglas J Steele

Do you have a table that translates Network ID to Staff Code? Get their
Network ID, use DLookup to get their Staff Code and stuff it into the field.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Ricoy-Chicago said:
Each user has his/her own computer. At any given time the six of them maybe
entering data into the master file. Yes, the current network id is enough to
tell me the staff code. I have no problem here.

The data entry form is based on three tables: [StaffInformation] - it
contains the [StaffCode] field. [CustomerInformation] and [Invoices]

Everything works, except my boss asked if the staff does really have to type
their [StaffCode].

Currently, they have to type their code because the form is based on the
query. If I set the [StaffCode] field value to the value given by the Network
ID, still it does not displays the value in the form, this value is used to
run the query, instead... argh...
Can i set the property "default value" using coding? I f i do it, is it
going to change the value on all the records or only on the new ones that are
being typed?
I almost giving up and let the users type their codes...
I may check this newsgroup until tomorrow, time to go home... Thanks...


Douglas J Steele said:
You really haven't answered my question.

Are you saying that any one of six different people can be using the same
machine, so that you don't know which of the 6 is currently on the machine?
Or have you got the (more normal) situation where each person logs onto the
machine, does his/her work, then logs off the machine? In other words, at
any point in time, is knowing the current network id enough to tell you the
staff code?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


A user logs-on as "Joe Smith" into the LAN.
The front-end database recognizes "Joe Smith" and assigns the
[StaffCode]="joe"
No problem here.
A data entry screen is used by all six staff members, this screen is based
on a query. They have to type their [StaffCode]. For example, Joe
Smith
has
to type "joe" in the [StaffCode] field.
Question: How can the form assign the value to the [StaffCode] automatically
and this value be part of the record?

:

What is their "staff code" (or, more relevantly, can you determine it
without them having to provide it)?

If you know what it is, you can always put logic in the form's BeforeUpdate
event to set the value in the table.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


I have no problem capturing the logon name.
Each staff member enter records into the master database.
Via their staff code, reports can be generated to keep track of their
records.
No problems here so far.

When they enter the information for a new record, they have to
type
their
staff code, is there a way they don't have to type it? that it
will
show
automatically and to be saved along with the record they entering?

:

You can get the current network logon name with:

http://www.mvps.org/access/api/api0008.htm

And, the current computer name with:

http://www.mvps.org/access/api/api0009.htm

And, if using ms-access security, then currentuser() will return the
ms-access logon.

I often log all 3 of the above values in some applications.

So, just place a control on the form (your contorl that will hold
username),
and set the default to the first function from above

=fosUserName()

--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
[email protected]
http://www.members.shaw.ca/AlbertKallal
 
R

Ricoy-Chicago

I just added the usename to the [StaffInfo] table, it works. I knew it was
something very easy to do, dah... Thank you for your patience and help!

Douglas J Steele said:
Do you have a table that translates Network ID to Staff Code? Get their
Network ID, use DLookup to get their Staff Code and stuff it into the field.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Ricoy-Chicago said:
Each user has his/her own computer. At any given time the six of them maybe
entering data into the master file. Yes, the current network id is enough to
tell me the staff code. I have no problem here.

The data entry form is based on three tables: [StaffInformation] - it
contains the [StaffCode] field. [CustomerInformation] and [Invoices]

Everything works, except my boss asked if the staff does really have to type
their [StaffCode].

Currently, they have to type their code because the form is based on the
query. If I set the [StaffCode] field value to the value given by the Network
ID, still it does not displays the value in the form, this value is used to
run the query, instead... argh...
Can i set the property "default value" using coding? I f i do it, is it
going to change the value on all the records or only on the new ones that are
being typed?
I almost giving up and let the users type their codes...
I may check this newsgroup until tomorrow, time to go home... Thanks...


Douglas J Steele said:
You really haven't answered my question.

Are you saying that any one of six different people can be using the same
machine, so that you don't know which of the 6 is currently on the machine?
Or have you got the (more normal) situation where each person logs onto the
machine, does his/her work, then logs off the machine? In other words, at
any point in time, is knowing the current network id enough to tell you the
staff code?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


A user logs-on as "Joe Smith" into the LAN.
The front-end database recognizes "Joe Smith" and assigns the
[StaffCode]="joe"
No problem here.
A data entry screen is used by all six staff members, this screen is based
on a query. They have to type their [StaffCode]. For example, Joe Smith
has
to type "joe" in the [StaffCode] field.
Question: How can the form assign the value to the [StaffCode]
automatically
and this value be part of the record?

:

What is their "staff code" (or, more relevantly, can you determine it
without them having to provide it)?

If you know what it is, you can always put logic in the form's
BeforeUpdate
event to set the value in the table.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


message
I have no problem capturing the logon name.
Each staff member enter records into the master database.
Via their staff code, reports can be generated to keep track of their
records.
No problems here so far.

When they enter the information for a new record, they have to type
their
staff code, is there a way they don't have to type it? that it will
show
automatically and to be saved along with the record they entering?

:

You can get the current network logon name with:

http://www.mvps.org/access/api/api0008.htm

And, the current computer name with:

http://www.mvps.org/access/api/api0009.htm

And, if using ms-access security, then currentuser() will return the
ms-access logon.

I often log all 3 of the above values in some applications.

So, just place a control on the form (your contorl that will hold
username),
and set the default to the first function from above

=fosUserName()

--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
[email protected]
http://www.members.shaw.ca/AlbertKallal
 
S

SolarScott

I must be not "getting" it. I've referred to code in this (and other posts)
regarding displaying Computer_Name or CurrentUser, and all I get is errors.
How do I invoke/call to or make work these codes?
 
Top