Find Code:
All Words
Any of the Words
Exact Phrase
Home
:
Code
:
Forums
:
Submit
:
Mailing List
:
About
:
Contact
Code
All
VB.NET
ASP.NET
C#
VB Classic
ASP Classic
Snippets
Popular
Resources
Submit Code
Forums
Articles
Tips
Links
Books
Contest
Link to us
Procedure which demonstrates the use of the .Seek ...
Website:
http://www.a1vbcode.com/
Submitted:
1/1/2000
Version:
VB3
Compatibility:
VB3,4,5
Category:
Databases
Views:
20919
Procedure which demonstrates the use of the .Seek method to located a specific record in a recordset
Declarations:
none
Code:
Sub ChangeName(intID As Integer, strNewName As String,strPath As String) ' intID: An integer that indicates the EmployeeID value to search for. ' strNewName: The new value for the EmplyeeName field. Dim dbs As Database, rst As Recordset Dim strPath As String Set dbs = OpenDatabase(strbPath) ' Open a table-type recordset on the Employees table. Set rst = dbs.OpenRecordset("Employees", dbOpenTable) With rst ' Define current index. .Index = "PrimaryKey" ' Seek record. .Seek "=", intID ' If EmployeeID is found. If Not .NoMatch Then .Edit ' Change Employee Name. !EmployeeName = strNewName .Update Else MsgBox "No record found for EmployeeID: " & intID End If .Close End With End Sub
Home
|
Forums
|
Submit
|
Books
|
Mailing List
|
Advertising
|
About
|
Contact
© 2024 A1VBCode. All rights reserved.
Legal disclaimer & terms of use
Privacy statement