J
Jacques Schoofs
Hi there,
has anyone a solution to the following problem (in any
Access version):
I'm developing a database application where Excel files
are automatically imported and processed. The entire Excel
file is imported (no problem) and then each record is
processed individually.
Regional settings in Windows specify a "," (comma) as the
decimal separator.
Imagine following table, correctly imported in to an
Access table called 'tbl_import':
Field1 | Field2 | Field3
NTY | MAY | 28,39
TBO | JUN | 11
SMA | MAY | 23,30
I open, with VBA, a connection to the destination
table, 'tbl_dest' and verify each record from tbl_import
if it has already been imported to tbl_dest. Since there
is no primary key, other than taking all fields, I perform
a find in tbl_dest:
==================================================
1 'retrieving record values from tbl_import
2 field1 = rsImportFromTable.Fields(0)
3 field2 = rsImportFromTable.Fields(1)
4 field3 = rsImportFromTable.Fields(2)
5 'creating findSQL for tbl_dest
6 findSQL = "field1='" & field1 & "' AND field2='" &
field2 & "' AND field3=" & field3
7 'now searching if record already imported
8 rsImport2DestTable.FindFirst (findSQL)
===================================================
line 8 in the code above is where it fails, because the
decimal separator is a comma.
The resulting findSQL would be:
"field1='NTY' AND field2='MAY' AND field3=28,39
I know the easy solution is to change the regional
settings in Windows to have the decimal separator be a "."
(dot), but as this application will run on several
machines in several countries I cannot change this.
Does any of you know a solution to this?
(I'm sure someone does, because I'm surely not the only
person to have this problem).
Thanks in advance for letting me know,
Jacques Schoofs
has anyone a solution to the following problem (in any
Access version):
I'm developing a database application where Excel files
are automatically imported and processed. The entire Excel
file is imported (no problem) and then each record is
processed individually.
Regional settings in Windows specify a "," (comma) as the
decimal separator.
Imagine following table, correctly imported in to an
Access table called 'tbl_import':
Field1 | Field2 | Field3
NTY | MAY | 28,39
TBO | JUN | 11
SMA | MAY | 23,30
I open, with VBA, a connection to the destination
table, 'tbl_dest' and verify each record from tbl_import
if it has already been imported to tbl_dest. Since there
is no primary key, other than taking all fields, I perform
a find in tbl_dest:
==================================================
1 'retrieving record values from tbl_import
2 field1 = rsImportFromTable.Fields(0)
3 field2 = rsImportFromTable.Fields(1)
4 field3 = rsImportFromTable.Fields(2)
5 'creating findSQL for tbl_dest
6 findSQL = "field1='" & field1 & "' AND field2='" &
field2 & "' AND field3=" & field3
7 'now searching if record already imported
8 rsImport2DestTable.FindFirst (findSQL)
===================================================
line 8 in the code above is where it fails, because the
decimal separator is a comma.
The resulting findSQL would be:
"field1='NTY' AND field2='MAY' AND field3=28,39
I know the easy solution is to change the regional
settings in Windows to have the decimal separator be a "."
(dot), but as this application will run on several
machines in several countries I cannot change this.
Does any of you know a solution to this?
(I'm sure someone does, because I'm surely not the only
person to have this problem).
Thanks in advance for letting me know,
Jacques Schoofs