'Check in reference: Microsoft ActiveX Data Objects 2.8 Library
Option Explicit
Dim conn As ADODB.Connection
Public Sub ConDB()
Set conn = New ADODB.Connection
conn.Open "Provider=
Microsoft.Jet.OLEDB.4.0;
Data Source=" &
App.Path & "\myDATA.mdb;"
End Sub
Private Sub Command2_Click()
'SELECT:
Dim sql As String
Dim rs As ADODB.Recordset
Call ConDB
Set rs = New ADODB.Recordset
sql = "SELECT * FROM PO WHERE IDNO='VB'"
rs.Open sql, conn
MsgBox rs.Fields(1).Value
rs.Close
conn.Close
End Sub
Private Sub Command1_Click()
'INSERT:
Dim sql As String
Call ConDB
sql = "INSERT INTO PO (idno, name) values('VB','ACCESS')"
conn.Execute sql
conn.Close
End Sub
2006-09-02 17:07:33
·
answer #1
·
answered by VBACCESSpert 5
·
0⤊
0⤋
Here is a tutorial I found online: http://www.garybeene.com/vb/tut-sql.htm. It looks like you store the query in a string, to be called later.
2006-09-02 22:38:14
·
answer #2
·
answered by Bryan A 5
·
0⤊
0⤋
first declare a string variable to hold the query and then assign the query to that declare variable.
2006-09-02 22:58:41
·
answer #3
·
answered by misty 1
·
0⤊
0⤋
When you sit at your base i.e. home and date a girl using net, it is called dale base connectcvitycitt ....bla....bla...bla or what ever.
Wanna know any thing more.
2006-09-02 23:03:32
·
answer #4
·
answered by Anonymous
·
0⤊
0⤋