Results 1 to 7 of 7
  1. #1
    canfish is offline Novice
    Windows XP Access 2007
    Join Date
    Jul 2010
    Posts
    25

    Concatenating and then exporting to excel


    Hi all,

    I am running into a specific problem, namely:

    I am exporting many of my queries into excel tables. I have information entered into separate fields for the address of each facility (I am basing the database around facilities), but I want to export into excel so that the address is all in one field. How do I draw information from each field all into one field in my query, so that I can export it and have a nice simple "address" field?

    Thank you very much for your help.

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    Just concatenate them in the query As FieldName.

  3. #3
    canfish is offline Novice
    Windows XP Access 2007
    Join Date
    Jul 2010
    Posts
    25
    Hi ruralguy,

    Thanks for the reply! Unfortunately, I'm not sure quite how to follow your instructions. What does it mean to concatenate them "in the query As Fieldname"? I've tried using the expression builder, but it confuses me. What am I supposed to do, exactly?

    Thanks!

    canfish

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    Switch the Query Builder to SQL mode and copy it to a post along with what fields you want concatenated.

  5. #5
    canfish is offline Novice
    Windows XP Access 2007
    Join Date
    Jul 2010
    Posts
    25
    SELECT tblOffices.Ministry, tblOffices.OfficeName, tblOffices.CostCentre, tblOffices.AddressLine1, tblOffices.AddressLine2, tblOffices.City, tblOffices.PostalCode, tblOffices.SiteManager, tblOffices.SiteManagerPhone, tblOffices.SiteManagerEmail, tblEquipment.SpecialShippingInstructions, tblEmployees.FirstName, tblEmployees.LastName, tblEmployees.Email, tblEquipment.EquipmentType, tblEquipment.EquipmentMake, tblEquipment.EquipmentManufacturer, tblEquipment.EquipmentModel, tblEquipment.EquipmentSerialNumber, tblEquipment.AssetTagNumber, tblEquipment.ComputerName, tblEquipment.LeasedOwnedDesignation, tblEquipment.Lessor, tblEquipment.LeaseSupplementNumber, tblEquipment.LeaseEndDate, tblEquipment.HardwareIntent, tblEquipment.AdditionalInformation
    FROM (tblOffices INNER JOIN (tblEquipment INNER JOIN tblAssetts ON tblEquipment.PKEquipmentItemID = tblAssetts.FKEquipmentItemID) ON tblOffices.PKOfficeID = tblEquipment.FKOfficeID) INNER JOIN (tblEmployees INNER JOIN tblOfficeEmployees ON tblEmployees.PKEmployeeID = tblOfficeEmployees.FKEmployeeID) ON (tblEmployees.PKEmployeeID = tblAssetts.FKEmployeeID) AND (tblOffices.PKOfficeID = tblOfficeEmployees.FKOfficeID);

    I need the following to be concatenated:

    tblOffices.AddressLine1
    tblOffices.AddressLine2
    tblOffices.City
    tblOffices.PostalCode


    Thank you for your help!

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    Try this:
    Code:
    SELECT tblOffices.Ministry, tblOffices.OfficeName, tblOffices.CostCentre, tblOffices.AddressLine1 & vbCrLf &  tblOffices.AddressLine2 & vbCrLf & tblOffices.City & " " & tblOffices.PostalCode As FullAddress, tblOffices.SiteManager, tblOffices.SiteManagerPhone, tblOffices.SiteManagerEmail, tblEquipment.SpecialShippingInstructions, tblEmployees.FirstName, tblEmployees.LastName, tblEmployees.Email, tblEquipment.EquipmentType, tblEquipment.EquipmentMake, tblEquipment.EquipmentManufacturer, tblEquipment.EquipmentModel, tblEquipment.EquipmentSerialNumber, tblEquipment.AssetTagNumber, tblEquipment.ComputerName, tblEquipment.LeasedOwnedDesignation, tblEquipment.Lessor, tblEquipment.LeaseSupplementNumber, tblEquipment.LeaseEndDate, tblEquipment.HardwareIntent, tblEquipment.AdditionalInformation
    FROM (tblOffices INNER JOIN (tblEquipment INNER JOIN tblAssetts ON tblEquipment.PKEquipmentItemID = tblAssetts.FKEquipmentItemID) ON tblOffices.PKOfficeID = tblEquipment.FKOfficeID) INNER JOIN (tblEmployees INNER JOIN tblOfficeEmployees ON tblEmployees.PKEmployeeID = tblOfficeEmployees.FKEmployeeID) ON (tblEmployees.PKEmployeeID = tblAssetts.FKEmployeeID) AND (tblOffices.PKOfficeID = tblOfficeEmployees.FKOfficeID);
    If vbCrLf does not work in the query then use Chr(13) & Chr(11) instead.

  7. #7
    canfish is offline Novice
    Windows XP Access 2007
    Join Date
    Jul 2010
    Posts
    25
    Got it working. Thanks!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Exporting to Excel
    By DreamOn in forum Import/Export Data
    Replies: 1
    Last Post: 05-23-2010, 10:27 PM
  2. Exporting to Excel Problem
    By octu in forum Import/Export Data
    Replies: 1
    Last Post: 04-14-2010, 11:28 PM
  3. Really Need Help With Exporting to Excel
    By graviz in forum Import/Export Data
    Replies: 0
    Last Post: 09-24-2009, 08:29 AM
  4. Exporting a Report to Excel
    By bullwinkle55423 in forum Reports
    Replies: 0
    Last Post: 12-11-2007, 10:27 AM
  5. Exporting a chart to Excel?
    By hraup in forum Access
    Replies: 0
    Last Post: 08-31-2006, 12:21 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums