vb: how to open, read, write, update, search database?
Website Design
Website Promotion
Graphic Design
Programming
Free Software
Computer Tips
Discount Stores
|
This site provides users with the information about "vb, visual basic, vb6, database, how to open database, how to read db, how to write database, how to update db, search db, and more.
If you think that this site is helpful, please recommend your friends to visit our site.
How to open, read, write, update, search database?
The following is the code for opening, reading, writing, updating, searching database:
Public dbCurrent As Database
Public recCategories As Recordset
Private Sub Command1_Click()
Set dbCurrent = OpenDatabase(App.Path & "\test.mdb")
Set recCategories = dbCurrent.OpenRecordset("info")
Set rstInfo = dbCurrent.OpenRecordset("info")
With recCategories
Do While Not .EOF
.MoveNext
If .EOF Then
.MoveLast
Exit Do
End If
If .RecordCount = 0 Then
MsgBox "No matching records found."
Exit Do
Else
If (!province = "On") Then
.Edit
!province = "BC"
.Update
End If
End If
DoEvents
Loop
End With
recCategories.Close
dbCurrent.Close
Set dbCurrent = Nothing
End Sub
|