از منوی project گزینه refrences رو انتخاب کنید - بعد اونجا گزینه Microsoft ActiveX Data Objects 2.0 library پيدا کنيدو تيک بزنيد - Adodc مورد نظرتون رو هم با دیتابیس set کنید - بعد :



کد:
Dim db_file As String 
Dim conn As ADODB.Connection 
Dim rs As ADODB.Recordset 
Dim NumRec As Integer 

Set conn = New ADODB.Connection 
conn.ConnectionString = Adodc1.ConnectionString 
conn.Open 

On Error Resume Next 
conn.Execute "DROP TABLE Jadid" 
On Error GoTo 0 

conn.Execute "CREATE TABLE Jadid(" & "One INTEGER NOT NULL," & "Two VARCHAR(40) NOT NULL," & "Three VARCHAR(40) NOT NULL)" 

conn.Execute "INSERT INTO Jadid VALUES (1,'4','7')" 
conn.Execute "INSERT INTO Jadid VALUES (2,'5','8')" 
conn.Execute "INSERT INTO Jadid VALUES (3,'6','9')" 

Set rs = conn.Execute("SELECT COUNT (*) FROM Jadid") 
NumRec = rs.Fields(0) 

conn.Close 

MsgBox "Created ... "