Ok ... for my CHS (College in Highschool) VB class i have to make a score sheet for a team of four golfers and record then to golf.doc. I got all for the rogram working except one thing. When the user enters a golf course it the program is supposted to generate a code to go along with it. This code is supposed to be three (3) letters long and can only be letters. It is supposted to be the first, middle and last initials of the courses name.
if Pittsburgh Greens House Golf Course was evtered the code for it would be PGH
my question is can someone help me find a way to code this? I tried doing loops to search for spaces then taking hte letter after the space (using the left function) which i thought would work great, but for some reason it didn't.
Search With Initials
This is my code to find phone number in database using Firstname and lastname :
Private Sub btn_Find_Click()
Dim v_sSQL As String
Dim v_rsFind As New Recordset
Dim v_iLoop As Integer
Dim v_sActiveConnection As String
Dim v_iIndex As Integer
On Error GoTo Err
v_sActiveConnection = "Provider=Microsoft.Jet.OLEDB.3.51;Data Source=" & App.Path & "PhoneBook.mdb"
v_sSQL = "SELECT * FROM PhoneBook WHERE "
If frm_Find.tbx_FirstName.Text <> "" Then
v_sSQL = v_sSQL & "FirstName LIKE '" & frm_Find.tbx_FirstName.Text & "' AND "
If frm_Find.tbx_LastName.Text <> "" Then
v_sSQL = v_sSQL & "LastName LIKE '" & frm_Find.tbx_LastName.Text & "' AND "
If frm_Find.tbx_TelNo.Text <> "" Then
v_sSQL = v_sSQL & "TelNo LIKE '" & frm_Find.tbx_TelNo.Text & "' AND "
If frm_Find.tbx_EMail.Text <> "" Then
v_sSQL = v_sSQL & "EMail LIKE '" & frm_Find.tbx_EMail.Text & "' AND "
v_sSQL = Left(v_sSQL, Len(v_sSQL) - 5)
v_rsFind.Open v_sSQL, v_sActiveConnection
While Not v_rsFind.EOF
v_iIndex = v_iIndex + 1
frm_Find.lvw_Find.ListItems.Add , , v_rsFind.Fields!FirstName
frm_Find.lvw_Find.ListItems(v_iIndex).ListSubItems.Add 1, , v_rsFind.Fields!LastName
frm_Find.lvw_Find.ListItems(v_iIndex).ListSubItems.Add 2, , v_rsFind.Fields!TelNo
MsgBox Err.Description, vbCritical
But Now i've to search phone number in database using initials, for example, my name is feroz khan, i must be able to search using F or K or both accordingly to the text boxes. Please help me to finsh the coding. i'm running out of time. thank you.
Display Initials Of A Name...
i have an app where i need to display just the middle initials of a physician. suppose the name is Mark J Anthony MD. i receive this name from teh server as a string. i need to display this, as MJAMD.
similarly, if the name is Mark Anthony MD, i need to display it as MAMD.
or, if the name is Mark J Anthony, then need to display it as MJA.
or, if the name is Mark Anthony, then need to display it as MA.
any help please? this is quite urgent. thanx