msgbox, Pleeeeeeease HELP ME AS SOON AS YOU SEE THIS!!!

alireza1989@hot

Registered User.
Local time
Today, 14:34
Joined
Feb 26, 2007
Messages
23
Hi, I have a formcalled Register and this table contains Name-of-Employee, Username and some other fields. The form searches the Register table when someone wants the register, and if the username is already taken up by another user, it gives a message box saying that the username is already used, and also it will give some suggestions as well. I want the MsgBox to take the first letter of "Name of Employee" and then put it beside the username, and show it as a suggestion. Here is the code I already have:
Code:
Dim d As Database
Set d = CurrentDb
Dim r As Recordset
Set r = d.OpenRecordset("Staff Login")

Dim h As String
h = Me.Username

r.MoveFirst
Dim flag As Boolean
flag = False
Do While Not r.EOF
If h = r![Username] Then
    flag = True
End If
r.MoveNext
Loop

If flag = True Then
    MsgBox ("This Username already exists" & vbNewLine & vbNewLine & "Here are some suggestions:" & vbNewLine & (Me.Name_of_Employee) & (Me.Username) & vbNewLine & (Me.Username) & (Me.Name_of_Employee))
End If

The code works perfectly up to here, but the thing is that I want it to show the first letter of "Name of Employee" beside the "User Name" and maybe the other way around.

Please help me as soon as possible, I am really in a great hurry

Thanx in advance
 
Try the left function to extract the first position of the name, e.g.:

Left((Me.Name_of_Employee),1)

HTH
 
Thanx a lot mate. It works perfectly
 

Users who are viewing this thread

Back
Top Bottom