I need coding to delete records from MS-Access 2007 from VB 6.0 using ADO
Help me
VB6.0 ado codingMS access07 connect with vb6.0
Page 1 of 1
4 Replies - 5288 Views - Last Post: 26 March 2012 - 02:48 PM
Replies To: VB6.0 ado coding
#2
Re: VB6.0 ado coding
Posted 25 August 2010 - 06:37 AM
The VB6 Tutorials Section is a great place to start. I believe we have a couple of VB6 with MS-Access tutorials. After you read the tutorials, try writing the code. We will be happy to help you with your good faith efforts if you run into trouble.
#3
Re: VB6.0 ado coding
Posted 25 August 2010 - 03:50 PM
You will need to update the SQL and Database Path in the code.
If it helps please rate it!!!!
If it helps please rate it!!!!
Sub DeleteSomeRecordsADO()
Dim cnn As ADODB.Connection
Dim cmdCommand As ADODB.Command
Dim vtSql
Dim DbConnection as String, DbSource as String
DbSource = "Path to your Database should be here!!!"
DbConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & DbSource & ";"
'' Open the connection.
Set cnn = New ADODB.Connection
cnn.Open DbConnection
'' Set the command text.
Set cmdCommand = New ADODB.Command
Set cmdCommand.ActiveConnection = cnn
'' - - - - - - - - - - - - - - - - - - - - - - - - - - - -
vtSql = ""
vtSql = vtSql & " DELETE * "
vtSql = vtSql & " FROM MyTable "
vtSql = vtSql & " WHERE MyField='MyValue'"
With cmdCommand
.CommandText = vtSql
.CommandType = adCmdText
.Execute
End With
'' Close the connections and clean up.
cnn.Close
Set cmdCommand = Nothing
Set cnn = Nothing
End Sub
#4
Re: VB6.0 ado coding
Posted 21 March 2012 - 10:38 PM
Will this method work with Microsoft.Ace.12.0 ? I'm trying to write something similar in javascript using Access 2007?
parbipin, on 25 August 2010 - 03:50 PM, said:
You will need to update the SQL and Database Path in the code.
If it helps please rate it!!!!
If it helps please rate it!!!!
Sub DeleteSomeRecordsADO()
Dim cnn As ADODB.Connection
Dim cmdCommand As ADODB.Command
Dim vtSql
Dim DbConnection as String, DbSource as String
DbSource = "Path to your Database should be here!!!"
DbConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & DbSource & ";"
'' Open the connection.
Set cnn = New ADODB.Connection
cnn.Open DbConnection
'' Set the command text.
Set cmdCommand = New ADODB.Command
Set cmdCommand.ActiveConnection = cnn
'' - - - - - - - - - - - - - - - - - - - - - - - - - - - -
vtSql = ""
vtSql = vtSql & " DELETE * "
vtSql = vtSql & " FROM MyTable "
vtSql = vtSql & " WHERE MyField='MyValue'"
With cmdCommand
.CommandText = vtSql
.CommandType = adCmdText
.Execute
End With
'' Close the connections and clean up.
cnn.Close
Set cmdCommand = Nothing
Set cnn = Nothing
End Sub
#5
Re: VB6.0 ado coding
Posted 26 March 2012 - 02:48 PM
This is the general way to handle deletes using ADO and Access, yes. Should work for you.
Page 1 of 1
|
|

New Topic/Question
Reply
MultiQuote









|