To work around this problem, follow these steps:
- Concatenate a character to the numeric values that are in a
text field. For example, you can concatenate an apostrophe (').
- Export the report to Excel.
- Remove the concatenated character from the field in
Excel.
To work around the problem for the example that is provided in
the "Steps to Reproduce the Problem" section, follow these steps:
- Start Access.
- Open the C:\MyExample.mdb database.
- In the Database window under
Objects, click Reports.
- In the right-pane, right-click MyReport
and then click Design View.
- In the Detail section, right-click the
MyText text box and then click
Properties.
- In the Text Box: myText dialog box, click
the Data tab.
- In the Control Source box, type
=[MyText] & "'".
- Click
the All tab, and then change the value of the Name
property to MyText1.
- Click the Print Preview icon.
- On the Tools menu, point to Office
Links and then click Analyze It with Microsoft
Excel.
You can see that the values in the
MyText
column display correctly. However, the values each have an apostrophe-character
suffix.
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.
To remove the apostrophe-character suffix from the
MyText column in Excel, follow these steps:
- Select the columns that have the apostrophe-character
suffix.
- On the Tools menu, point to
Macro and then click Visual Basic
Editor.
- In the Project - VBA Project window, click
ThisWorkbook.
- On the View menu, click
Code.
- Paste the following code in the Code
window:
Private Sub Workbook_Open()
Selection.Replace What:="'", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End Sub
- In the Code window, click any part of the
code that is mentioned in step 5. On the Run menu, click
Run Sub/UserForm.
- On the File menu, click Close and
Return to Microsoft Office Excel.
Note The apostrophe-character suffix is removed from the selected
columns.