Hi Folks,
after extensive searching this helpful DB here I have to post a question:
I have a Customer Details Tabel which i import from excel. The file selection for the import is done via a module called "fgetfilename". Then I add 2 fields to the table ("timestamp" and "AE Actual Complete Date"
to prepare the data for appending it to a resident table and giving it a timestamp. I do this via queries and it works fine so far.
Now I should check the imported table for the value of 1 field (se_country) and compare it to a predefined value, in this case "NETHERLANDS". Normally just the first or one record needs to be checked, since the data comes sorted by countries out of a SIEBEL system. This validyation is needed, so that a user can not accidently choose a wrong Excel file for import (and corrupt the data).
The code I have so far (as Command Button code) is pasted below. Any help or helpful hints would be nice.
regards
Klaus
after extensive searching this helpful DB here I have to post a question:
I have a Customer Details Tabel which i import from excel. The file selection for the import is done via a module called "fgetfilename". Then I add 2 fields to the table ("timestamp" and "AE Actual Complete Date"
Now I should check the imported table for the value of 1 field (se_country) and compare it to a predefined value, in this case "NETHERLANDS". Normally just the first or one record needs to be checked, since the data comes sorted by countries out of a SIEBEL system. This validyation is needed, so that a user can not accidently choose a wrong Excel file for import (and corrupt the data).
The code I have so far (as Command Button code) is pasted below. Any help or helpful hints would be nice.
regards
Klaus
Code:
Dim Name As String
Dim dbs As Database
Dim tdf As TableDef
Dim fld1 As Field
Dim fld2 As Field
DoCmd.SetWarnings False
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel7, "tbl_Eingang_NL_temp", "" + fGetFileName, True
Set fld1 = tdf.CreateField("timestamp", dbDate)
Set fld2 = tdf.CreateField("AE Actual Complete Date", dbDate)
tdf.Fields.Append fld2
tdf.Fields.Append fld1
tdf.Fields.Refresh
Set dbs = Nothing
DoCmd.OpenQuery "qry_Timestamp_Eingang_NL_temp"
DoCmd.OpenQuery "qry_append_Eingang_NL_temp"
DoCmd.SetWarnings True
DoCmd.DeleteObject acTable, "tbl_Eingang_NL_temp"
MsgBox "Import der Daten für NL fertig", vbInformation, "Import NL Daten"