Noname > 23-08-10, 04:14 PM
Private Sub Command0_Click()
Dim DB As Database
' Dim query1 As QueryDef
Dim query1 As QueryDef
Dim SQL1 As String
SQL1 = "select maso, sum(table2.sotien) as sotien, count(sohd) as slhd from table2 group by maso"
Set DB = CurrentDb
Set query1 = DB.CreateQueryDef("query1", SQL1)
DB.Execute "select query1.maso, table1.ten, query1.sotien, query1.slhd into table3 from query1 left join table1 on query1.maso=table1.maso"
' xoa table tam di
DB.QueryDefs.Delete "query1"
msgbox " insert Data to table 3 successful"
Set DB = Nothing
End Sub
pfsvn > 17-12-10, 04:01 PM
Cafe Via He > 17-12-10, 04:29 PM
(17-12-10, 04:01 PM)pfsvn Đã viết: CHo mình hỏi. Mình cũng khai báo " Dim DB As Database", nhưng mà Access 2003 lại báo lổi không chấp nhận kiểu database. Chỉ mình cách khắc phục