Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Append Query, SQL and Spacing

Status
Not open for further replies.

davidmo

Technical User
Apr 8, 2003
97
US
I am trying to run 2 append queries and concatenate two of the fields, (Last Name and First Name to create Full Name). The code runs fine except the space after the comma between the last name and first name does not show up even though it is in the code. Very confused since the comma shows up but not the space.

Here is the code:
Private Sub Form_Open(Cancel As Integer)
Dim strappendClient As String, strappendRealtor As String

strappendClient = "INSERT INTO tblGeneralList ( First_Name, Last_Name, Type, Full_Name )" & _
" SELECT tbl_Borrower_Personal_Information.Borrower_First_Name, tbl_Borrower_Personal_Information.Borrower_Last_Name," & _
" 'Client' AS Expr1, [Borrower_Last_Name] & ', '" & _
" & [Borrower_First_Name] AS Full_Name" & _
" FROM tbl_Borrower_Personal_Information"

strappendRealtor = "INSERT INTO tblGeneralList ( First_Name, Last_Name, Type, Full_Name )" & _
" SELECT ref_Realtor.Realtor_First_Name, ref_Realtor.Realtor_Last_Name," & _
" 'Realtor' AS Expr1, [Realtor_Last_Name]& ', '" & _
" & [Realtor_First_Name] AS Full_Name FROM ref_Realtor"

'Turn off Warnings
DoCmd.SetWarnings False

DoCmd.RunSQL strappendClient
DoCmd.RunSQL strappendRealtor

'Turn on Warnings
DoCmd.SetWarnings True


End Sub

thanks.

DMo
 

How about...
Code:
strappendClient = 
"INSERT INTO tblGeneralList(First_Name, Last_Name, Type, Full_Name)" & _
"SELECT Borrower_First_Name, Borrower_LastName, " & _
"'Client' AS Expr1, Borrower_Last_Name & ', ' & _
Borrower_FirstName AS FullName " & _
"FROM tbl_Borrower_Personal_Information"


Randy
 
Randy:
thanks for the idea, unfortunately I tried this and it didn't work.

DMO
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top