感谢两位的回复:VB代码如下就是用友凭证控件调用例程,Dim WithEvents m_objPz As clsPZ '定义凭证对象Attribute m_objPz.VB_VarHelpID = -1Private Sub Command4_Click() '注册对象实例化 Set m_login = New U8Login.clsLogin m_login.Login ("FA")End SubPrivate Sub Command2_Click() '总账公用函数实例化 Dim UfDb As New UfDbKit.UfDatabase UfDb.OpenDatabase m_login.UfDbName Set m_ZwPub = New clsPub m_ZwPub.InitPubs2 "FA", m_login.UfSystemDb, UfDb, m_login.cAcc_Id, m_login.cIYear, m_login.cUserId, m_login.CurDate, m_login.SysPassword '准备数据,临时表结构参见总账数据库结构文档的凭证表 Dim I As Integer, rstVouch As UfRecordset SQL = "select * from " & m_ZwPub.WbTableName Set rstVouch = m_ZwPub.DataMdb.OpenRecordset(SQL) For I = 0 To 1 rstVouch.AddNew rstVouch!ioutperiod = 11 rstVouch!coutsign = "项目" rstVouch!coutno_id = "123456" rstVouch!coutsysname = "FA" rstVouch!cbill = m_login.cUserName rstVouch!inid = I '以上字段必填 rstVouch!doutbilldate = "2007-11-23" rstVouch!coutaccset = m_ZwPub.AccountSet.cAcc_Id rstVouch!ioutyear = m_ZwPub.AccountCurrent.OperateYear rstVouch!coutid = "票号123456" rstVouch!coutbillsign = "项目" rstVouch!coutsysver = Null rstVouch!doutdate = "2007-11-23" rstVouch!idoc = 0 rstVouch!cDigest = "出差费用" If I = 0 Then rstVouch!cCode = 1002 Else rstVouch!cCode = 1121 End If If I = 0 Then rstVouch!md = 100.1 rstVouch!mc = 0 Else rstVouch!md = 0 rstVouch!mc = 100.1 End If rstVouch!md_f = 0 rstVouch!mc_f = 0 rstVouch!nfrat = 0 rstVouch!nd_s = 0 rstVouch!nc_s = 0 rstVouch!cdept_id = Null rstVouch!citem_id = Null rstVouch!citem_class = Null rstVouch!ccus_id = Null rstVouch!csup_id = Null rstVouch!cperson_id = Null '控制字段 rstVouch!bvouchedit = True '凭证是否可修改 rstVouch!bvouchAddordele = True '凭证分录是否可增删 rstVouch!bvouchmoneyhold = False '凭证合计金额是否保值 rstVouch!bvalueedit = True '分录数值是否可修改 rstVouch!bcodeedit = True '分录科目是否可修改 rstVouch!bPCSedit = True '分录往来项是否可修改 rstVouch!bDeptedit = True '分录部门是否可修改 rstVouch!bItemedit = True '分录项目是否可修改 rstVouch!bCusSupInput = True '分录往来项是否必输 rstVouch.Update Next I '调用凭证对象 Set m_objPz = New clsPZ Set m_objPz.zzLogin = m_login Set m_objPz.zzSys = m_ZwPub m_objPz.StartUpPz "FA", "FA1516", Pz_ZD Set m_objPz = Nothing: Set m_ZwPub = NothingEnd SubPrivate Sub m_objPz_Save(rstCurrentVouch As UfDbKit.UfRecordset, IsSuccess As Boolean) IsSuccess = False '用户业务处理 开始 '用户业务处理 结束 IsSuccess = True End SubSave:功能:其它系统(不包括总账)调用凭证,需要定义该控件带有事件。例如:Private WithEvents m_objPz As clsPZ用户必须处理Save事件。方法:Save(rstCurrentVouch As UfDbKit.UfRecordset, IsSuccess As Boolean)参数说明:RstCurrentVouch 为当前凭证结果集IsSuccess 为是否同意提交该凭证, IsSuccess=True提交该凭证,IsSuccess=False放弃该凭证的保存。请各位DFW帮帮忙了.