954,568 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

save, edit, delete vb 6 using ms access

hey..my name is marluke..
i want to know the code of Save, Edit and Delete
using visual basic 6 and the database is Ms Access
does any body wants to help me?
please i really want to know and learn
visual basic..

thanks for helping

LuKeZ

marluke
Newbie Poster
4 posts since Mar 2008
Reputation Points: 10
Solved Threads: 0
 

Hi Luke...Welcome to Daniweb Friend :)
visit this following links to learn how to connect access with vb.
- VB And Ms Access
- VB6 Database Guide
Then try it, if u get some problem post it here.
Happy Coding Friend :)

Jx_Man
Nearly a Senior Poster
3,329 posts since Nov 2007
Reputation Points: 1,372
Solved Threads: 444
 

hi marluke
if u use a data control ur code will be :
data1.recordset.update ' for save
data1.recordset.edit ' for edit
data1.recordset.delete ' for delete
data1.recordset.refresh ' for delete

ahmed elweshahy
Newbie Poster
18 posts since Apr 2007
Reputation Points: 6
Solved Threads: 0
 

:) :D :*

hjjhiuhij
Newbie Poster
2 posts since Apr 2011
Reputation Points: 10
Solved Threads: 0
 

:)) (^^^)

hjjhiuhij
Newbie Poster
2 posts since Apr 2011
Reputation Points: 10
Solved Threads: 0
 

EDIT
Module1.setConnectProc
Set globRSrecordset = New ADODB.Recordset
globRSrecordset.Open "SELECT * FROM table_name WHERE BkTitle='" & Trim(txtTitle) & "'", strVar, adOpenKeyset, adLockOptimistic
With globRSrecordset
If Not .EOF Then
!BkTitle = txtTitle
!Author = txtAuthor
!BkRefNo = Val(txtBkRefNo)
!TrnDate = txtDate
MsgBox "Record Updated!", vbInformation, "Updated Existing Record"
.Update
.MoveLast
End If
.Close
End With

DELETE connectModule.setConnectProc
Set globRSrecordset = New ADODB.Recordset
globRSrecordset.Open "SELECT * FROM table_name WHERE BkTitle='" & Trim(txtTitle) & "'", strVar, adOpenKeyset, adLockOptimistic
With globRSrecordset
If Not .EOF Then
.Delete
End If
.Close
End With


Module1 Public globDBConnect As ADODB.Connection
Public globRSrecordset As ADODB.Recordset
Public strVar As String

Public Sub setConnectProc()
Set globDBConnect = New ADODB.Connection
strVar = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Location\DatabseName.accdb;Persist Security Info=False"
globDBConnect.Open strVar

End Sub

If you are using Access 2007 use .accdb
If you are using Access 2003 use .mdb

pmark019
Light Poster
27 posts since Sep 2010
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You