Hi Perplexed,
This is a regular source of frustration. The Jet database engine used by
Access applies subtly different rules when linking and when importing;
either way it pays virtually no attention to Excel cell formats.
When the problem is a column with a mix of numeric and non-numeric
values, a reliable fix is to prefix the numeric values with an
apostrophe, e.g.
'1234
instead of
1234
This forces both Excel and Access to treat the value as a string of
digits and not a number. The apostrophe doesn't show up in the workbook
(only in the formula bar) or in Access. This Excel VBA procedure will
add apostrophes to numeric values in selected cells:
Sub AddApostrophes()
Dim C As Excel.Range
For Each C In Application.Selection.Cells
If IsNumeric(C.Formula) Then
C.Formula = "'" & C.Formula
End If
Next
End Sub
On Fri, 18 Aug 2006 08:41:31 -0700, PerplexedinKY
<PerplexedinKY@discussions.microsoft.com> wrote:
--
John Nurick [Microsoft Access MVP]
Please respond in the newgroup and not by email.
|