我有一个由这样的程序生成的excel表
我想将该表格导入ms access programme.how,通过过滤数据将这些数据导入相关表格。
| DEPTNO | DEPTNAME | =>(dept table)
| StaffNo | StaffName | =>(员工表)
| DEPTNO | StaffNo | WorkDate |周| =>(出勤表)
答案 0 :(得分:0)
您可以编写一个概述为 -
的程序Revised on 3/25 late
Dim WeAreInWorkDates As String
For each row in worksheet
If ColA.value = Dept row then
WeAreInWorkDates = "NO" 'reset flag to false
get values
if these values don't already exist in DeptTable then
Insert new row into DeptTable
endif
elseIf ColA.value = Staff row then
WeAreInWorkDates = "NO" 'reset flag to false
get values
if these values don't already exist in StaffTable then
Insert new row into StaffTable
endif
elseIf ColA.value = "WorkDate"
bypass row
WeAreInWorkDates = "YES" ' set flag
elseIf ColA.value = "Summary"
bypass row
WeAreInWorkDates = "NO" 'reset flag to false
elseIf ColA.value = blanks
bypass row
elseIf WeAreInWorkDates = "YES" then
'get values from the row into local variables
Dim xxx
xxx = myXLS.Cells(nRow,nCol) ... etc
' Prevent double posting of the XLS into the MDB tables
'if these values don't exist in AttendanceTable then
SET rst = db(Select * From AttendanceTable Where atKey = xxx(i.e. myLocalVars))
if rst.BOF and rst.EOF then ' rst is empty, ergo not yet posted
Insert row in AttendanceTable
endif
else
display that we have an unknown row
endif