Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / February 2006

Tip: Looking for answers? Try searching our database.

Concatenate data from Imported Excel Spreadsheet

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
SharonInGeorgia - 03 Feb 2006 16:30 GMT
I created a table using SQL then inserted fields from an Excel spreadsheet
into the new table.  In the new table, however, I need to combine three of
the fields from the imported spreadsheet to create one field.    For many
records, however, Field 2 does not have any data so the term “Field2”  is
returned with the combined data.
 
5000 & ([Field2]) & AA    ----   instead of 5000AA

What do I need to do for Field2 when there is not data in it?   Placing a 0
in the field will mess up the ConcatField value.  

'*********************CODE*******************
dbs.Execute "CREATE TABLE tblAccounts" _
& "( Field1 CHAR (6), Field2 CHAR (4) Field3 (CHAR2), **Concat field*** CHAR
(14)…..

DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel7, "tblAccounts2…..

DoCmd.RunSQL "INSERT INTO tblAccounts (Field1, Field2, Field3, *Concatfield*
& "SELECT Field1, Field2, Field3, ([Field1]) & "" & ([Field2]) & "" &
([Field3]) AS Concat field
Klatuu - 03 Feb 2006 18:25 GMT
Untested, but try this:
DoCmd.RunSQL "INSERT INTO tblAccounts (Field1, Field2, Field3, *Concatfield*
& "SELECT Field1, Field2, Field3, Nz([Field1],"") & "" & Nz([Field2],"") &
"" &
Nz([Field3],"") AS Concat field

> I created a table using SQL then inserted fields from an Excel spreadsheet
> into the new table.  In the new table, however, I need to combine three of
[quoted text clipped - 17 lines]
> & "SELECT Field1, Field2, Field3, ([Field1]) & "" & ([Field2]) & "" &
> ([Field3]) AS Concat field
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.