AddNew Method Example
来源:互联网 发布:怎么打鼓谱软件 编辑:程序博客网 时间:2024/05/16 12:52
'This example uses the AddNew method to create a new record with the specified 'name. The AddName function is required for this procedure to run.
Sub AddNewX()
Dim dbsNorthwind As Database
Dim rstEmployees As Recordset
Dim strFirstName As String
Dim strLastName As String
Set dbsNorthwind = OpenDatabase("Northwind.mdb")
Set rstEmployees = _
dbsNorthwind.OpenRecordset("Employees", dbOpenDynaset)
' Get data from the user.
strFirstName = Trim(InputBox( _
"Enter first name:"))
strLastName = Trim(InputBox( _
"Enter last name:"))
' Proceed only if the user actually entered something
' for both the first and last names.
If strFirstName <> "" and strLastName <> "" Then
' Call the function that adds the record.
AddName rstEmployees, strFirstName, strLastName
' Show the newly added data.
With rstEmployees
Debug.Print "New record: " & !FirstName & _
" " & !LastName
' Delete new record because this is a demonstration.
.Delete
End With
Else
Debug.Print _
"You must input a string for first and last name!"
End If
rstEmployees.Close
dbsNorthwind.Close
End Sub
Function AddName(rstTemp As Recordset, _
strFirst As String, strLast As String)
' Adds a new record to a Recordset using the data passed
' by the calling procedure. The new record is then made
' the current record.
With rstTemp
.AddNew
!FirstName = strFirst
!LastName = strLast
.Update
.Bookmark = .LastModified
End With
End Function
- AddNew Method Example
- Edit Method Example
- wxWidgets http post method example
- Design Patterns - Factory Method - Example 1
- A Example of Factory Method for Java
- Example: solving ODE using FEM method
- Spring(7)-Spring init-method and destroy-method example
- Example: Calling a Provider Method (Windows)(学习学习)
- How to override compareTo method in Java - Example Tutorial
- Simple Factory Vs Factory Method Vs Abstract Factory by Example
- Spring Security 4 Method Level Secured Example(8)
- Could not find class 'com.example.adapter.MyCursorAdapter' referenced from method com.example..
- CRecordset::AddNew()函数
- 二叉树 create addnew
- ADO Recordset addnew
- ADO中使用addnew
- example
- example
- Imperfect C++ Practical Solutions for Real-Life Programming-Chapter11.Statics
- vbscript byref 的用法
- JSF简介
- Edit Method
- Edit Method Example
- AddNew Method Example
- 2005年晓通网络面试题
- 简单
- Apache2.0.53+Tomcat5.5.9整合教程(Windows篇) [摘]
- JAVA开发者应该去的20几个英文网站
- DB语法
- unix和dos文本文件的一点区别
- [OnJava] Wire Hibernate Transactions in Spring
- Draw2D设计--3. LightweightSystem设计和实现剖析(1)