主题:书中原代码问题
This.Parent.oleProgressBar.Visible=.T. &&显示进度条
IF USED("tblTallyTableBak") &&关闭备份表
USE IN tblTallyTableBak
ENDIF
Thisform.Refresh
This.Parent.oleProgressBar.Max=4
SELECT &cCurrentTallyName &&选择当前账套,该变量在frmLogin表单中定义
COPY TO tblTallyTableBak FOR NOT DELETED() WITH CDX &&备份当前数据表
USE IN &cCurrentTallyName &&关闭表
USE tblTallyTableBak ALIAS tblTallyTableBak IN 0
**根据工资项目列表生成新账套格式
DROP TABLE &cCurrentTallyName
CREATE TABLE &cCurrentTallyName(员工编号 N(10) UNIQUE,员工姓名 C(10),所属部门 C(20))
SELECT tblSalaryItem
nRecn=RECNO() &&保存当前记录位置
SCAN
cFieldName=ALLTRIM(tblSalaryItem.fldItem)
ALTER TABLE &cCurrentTallyName ADD &cFieldName N(15,2)
ENDSCAN
ALTER TABLE &cCurrentTallyName ADD Py C(20) &&加入存放员工姓名拼音的字段
This.Parent.oleProgressBar.Value=1
**将原来账套中的数据导入到新表中
SELECT &cCurrentTallyName
APPEND FROM tblPerson FIELDS 员工编号,员工姓名,所属部门 &&从人员信息表中将最新人员数据添加到账套中
REPLACE Py WITH ChrToPy(ALLTRIM(员工姓名)) ALL &&生成拼音码
This.Parent.oleProgressBar.Value=2
SELECT tblSalaryItem
SCAN
cField=tblSalaryItem.fldItem
cOldField=tblSalaryItem.fldBackupItem
SELECT tblTallyTableBak
SCAN
UPDATE &cCurrentTallyName SET &cCurrentTallyName..&cField=tblTallyTableBak.&cOldField WHERE &cCurrentTallyName..员工编号=tblTallyTableBak.员工编号是 &&有问题!!!!!!!!!!!
ENDSCAN
ENDSCAN
This.Parent.oleProgressBar.Value=3
**重新设置表、按钮等
SELECT &cCurrentTallyName
SET DELETED ON
GO TOP
This.Parent.oleProgressBar.Value=4
=MESSAGEBOX("当前账套的工资项目已经正确存储完毕!",0+64,"提示")
This.Parent.oleProgressBar.Visible=.F. &&隐藏进度条
This.Enabled=.F. &&按钮重新恢复为禁止状态
SELECT tblSalaryItem
GO nRecn &&移动记录到先前的保存位置
Thisform.Refresh
This.Parent.grdSalaryItem.SetFocus
IF USED("tblTallyTableBak") &&关闭备份表
USE IN tblTallyTableBak
ENDIF
Thisform.Refresh
This.Parent.oleProgressBar.Max=4
SELECT &cCurrentTallyName &&选择当前账套,该变量在frmLogin表单中定义
COPY TO tblTallyTableBak FOR NOT DELETED() WITH CDX &&备份当前数据表
USE IN &cCurrentTallyName &&关闭表
USE tblTallyTableBak ALIAS tblTallyTableBak IN 0
**根据工资项目列表生成新账套格式
DROP TABLE &cCurrentTallyName
CREATE TABLE &cCurrentTallyName(员工编号 N(10) UNIQUE,员工姓名 C(10),所属部门 C(20))
SELECT tblSalaryItem
nRecn=RECNO() &&保存当前记录位置
SCAN
cFieldName=ALLTRIM(tblSalaryItem.fldItem)
ALTER TABLE &cCurrentTallyName ADD &cFieldName N(15,2)
ENDSCAN
ALTER TABLE &cCurrentTallyName ADD Py C(20) &&加入存放员工姓名拼音的字段
This.Parent.oleProgressBar.Value=1
**将原来账套中的数据导入到新表中
SELECT &cCurrentTallyName
APPEND FROM tblPerson FIELDS 员工编号,员工姓名,所属部门 &&从人员信息表中将最新人员数据添加到账套中
REPLACE Py WITH ChrToPy(ALLTRIM(员工姓名)) ALL &&生成拼音码
This.Parent.oleProgressBar.Value=2
SELECT tblSalaryItem
SCAN
cField=tblSalaryItem.fldItem
cOldField=tblSalaryItem.fldBackupItem
SELECT tblTallyTableBak
SCAN
UPDATE &cCurrentTallyName SET &cCurrentTallyName..&cField=tblTallyTableBak.&cOldField WHERE &cCurrentTallyName..员工编号=tblTallyTableBak.员工编号是 &&有问题!!!!!!!!!!!
ENDSCAN
ENDSCAN
This.Parent.oleProgressBar.Value=3
**重新设置表、按钮等
SELECT &cCurrentTallyName
SET DELETED ON
GO TOP
This.Parent.oleProgressBar.Value=4
=MESSAGEBOX("当前账套的工资项目已经正确存储完毕!",0+64,"提示")
This.Parent.oleProgressBar.Visible=.F. &&隐藏进度条
This.Enabled=.F. &&按钮重新恢复为禁止状态
SELECT tblSalaryItem
GO nRecn &&移动记录到先前的保存位置
Thisform.Refresh
This.Parent.grdSalaryItem.SetFocus