switching lastname, firstname to firstname lastname

H

harvey

I use access 2000 and don't know programming. I want to
create a simple update query for the name field to switch
around from lastname, firstname to firstname last name.
Also can I change Uppercase to initial case.

i.e SANDERS, Harvey G. to Harvey G. Sanders.

If possible can you write out the syntax, so I can copy
and past into the update query, so I won't mess it up.

Thanks in advance.

Harvey
 
E

Ed Warren

1. Store two fields [FirstName], and field [LastName]
2. Now you don't need an 'update query' since the FirstName is always the
FirstName and the LastName is always the last name

3. When you want a report, form, etc with an entry like

Harvey Smith or Smith, Harvey

you enter the following in the query:

FirstNameLastName: [FirstName] & " " & [LastName] --> results in Harvey
(space) Smith
and
LastNameFirstName:[LastName] & ", " & [FirstName] --> results in Smith
(,space) Harvey

Note the "&" concatenates (combines) strings so what the above is saying is:
return a new field named FirstNameLastName with the last name combined with
a space and the first name.

Regards the change of case, you can either change the case with an update
query or when you query for a report and/or form.

I use the following code snippet:

Public Function Pcase(strPassed As String) As String

'Convert into proper case string

Pcase = StrConv(strPassed, vbProperCase)


End Function



In the example above you could get the case you want with:



FirstNameLastName: StrConv([FirstName] & " " & [LastName] --> results in
Harvey (space) Smith,vbProperCase)

but I do it via the code with

FirstNameLastName: Pcase(FirstNameLastName: [FirstName] & " " &
LastName] --> results in Harvey (space) Smith)



Hope this helps

Ed Warren
 

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