I am testing my database using the sample code from Northwind database and I'm trying to apply this to my application.
Rather than hard-coding references to specific "Title" and value, I want to be able to use the code with other text boxes I have in my form?
Private Sub cmdUpdate_Click()
'This example code illustrates a standard use of the Update method
'after using the Edit method and making some changes to a record,
'in a looping structure that iterates through an entire recordset:
Dim dbs As Database
Dim strDBName As String
Dim rst As Recordset
strDBName = "C:\Program Files\Microsoft Office\Office\Samples\Northwind.mdb"
Set dbs = OpenDatabase(strDBName)
Set rst = dbs.OpenRecordset("Employees", dbOpenTable)
With rst
.MoveFirst
Do While Not .EOF
.Edit
If !Title = "Sales Representative" Then !Title = "Sales Rep"
.Update
.MoveNext
Loop
.Close
End With
dbs.Close
End Sub
Thanks
Rather than hard-coding references to specific "Title" and value, I want to be able to use the code with other text boxes I have in my form?
Private Sub cmdUpdate_Click()
'This example code illustrates a standard use of the Update method
'after using the Edit method and making some changes to a record,
'in a looping structure that iterates through an entire recordset:
Dim dbs As Database
Dim strDBName As String
Dim rst As Recordset
strDBName = "C:\Program Files\Microsoft Office\Office\Samples\Northwind.mdb"
Set dbs = OpenDatabase(strDBName)
Set rst = dbs.OpenRecordset("Employees", dbOpenTable)
With rst
.MoveFirst
Do While Not .EOF
.Edit
If !Title = "Sales Representative" Then !Title = "Sales Rep"
.Update
.MoveNext
Loop
.Close
End With
dbs.Close
End Sub
Thanks