Scripting

  • Thread starter Specific User Form Access
  • Start date
S

Specific User Form Access

Does anyone have a script that will combine the first initial of the first
name and the entire last name to make a username??? The first name and last
name fields are two different fields in the DB table. I have created a
"username" field in the same table.
 
D

Douglas J. Steele

Well, you shouldn't have the username field if it's based on the value of
other fields. Calculated values should never be stored. As fellow Access MVP
John Vinson likes to say "Storing calculated data generally accomplishes
only three things: it wastes disk space, it wastes time (a disk fetch is
much slower than almost any reasonable calculation), and it risks data
validity, since once it's stored in a table either the Total or one of the
fields that goes into the total may be changed, making the value WRONG."

Create a query, and calculate the Username field in that query. Use the
query wherever you would otherwise have used the table. To add a calculated
field to a query, select any empty column in the grid, and type the
following in the Field row of that column:

Username: Left([Firstname], 1) & [Surname]

(Replace Firstname and Surname with the actual field names)

However, that's only part of the problem. Is Username supposed to be unique?
What happens if two people with the same surname have the same initial?

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


"Specific User Form Access"
 
B

bob

You don't need a script: use a query to create FirstInitial:Left ([first
name], 1). Then logon:[FirstInitial]+[Last name].

Bob


"Specific User Form Access"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top