http://www.d1vb.com上万个VB朋友都注册了,50000条记录就是人气的象征!几千个代码和文章是你急需的。我是版主和站长,欢迎您的光顾!我们会尽最大努力帮助你。
解决方案 »
- 用VB操作将金额这一列数字每个都减10,并保存为文本,如何实现????
- 新出了一款软件,大家评点一下(散分)
- 笔记本的fn键 用键盘钩子 可以截获到吗?
- dateadd函数据进行日期的加减,为何报错
- 第三颗星被KILL,继续...升到三星为止.
- vb6连不上officexp的access数据库,如何解决?
- 大哥们,如何才能通过代码判断一个网页文件是否存在(不是本机)?若不存在就不让用户打开此联接。
- Delphi转VB,高手帮忙指导一下.
- 获取recordst最新改变的方法是什么?
- 如何在列举窗口时判别多个同名窗口。
- 关于DataGrid控件在程序打包安装后出错!!!
- 关于Crystal Report,如何在一个页面内打印两个毫不相干的表?
Sub BeginTransX() Dim strName As String
Dim strMessage As String
Dim wrkDefault As Workspace
Dim dbsNorthwind As Database
Dim rstEmployees As Recordset ' Get default Workspace.
Set wrkDefault = DBEngine.Workspaces(0)
Set dbsNorthwind = OpenDatabase("Northwind.mdb")
Set rstEmployees = _
dbsNorthwind.OpenRecordset("Employees") ' Start of outer transaction.
wrkDefault.BeginTrans
' Start of main transaction.
wrkDefault.BeginTransWith rstEmployees ' Loop through recordset and ask user if she wants to
' change the title for a specified employee.
Do Until .EOF
If !Title = "Sales Representative" Then
strName = !LastName & ", " & !FirstName
strMessage = "Employee: " & strName & vbCr & _
"Change title to Account Executive?" ' Change the title for the specified employee.
If MsgBox(strMessage, vbYesNo) = vbYes Then
.Edit!Title = "Account Executive"
.Update
End If
End If .MoveNext
Loop ' Ask if the user wants to commit to all the changes
' made above.
If MsgBox("Save all changes?", vbYesNo) = vbYes Then
wrkDefault.CommitTrans
Else
wrkDefault.Rollback
End If ' Print current data in recordset.
.MoveFirst
Do While Not .EOF
Debug.Print !LastName & ", " & !FirstName & _" - " & !Title
.MoveNext
Loop ' Roll back any changes made by the user since this is
' a demonstration.
wrkDefault.Rollback
.Close
End With dbsNorthwind.CloseEnd Sub