包含重復(fù)項(xiàng)的表為infoData,表中字段為ID,企業(yè)名稱,注冊(cè)地址,企業(yè)負(fù)責(zé)人,經(jīng)營(yíng)范圍,建臨時(shí)表tbltemp
在窗體中建個(gè)按鈕,按鈕事件中寫代碼如下:
Private Sub Command0_Click()
Dim strsql As String
Dim strsql2 As String
Dim strsql3 As String
Dim strsql4 As String
strsql = "select distinct 企業(yè)名稱,注冊(cè)地址,企業(yè)負(fù)責(zé)人,經(jīng)營(yíng)范圍 into tbltemp from InfoData"
strsql2 = "delete from InfoData "
strsql3 = "insert into InfoData select * from tbltemp"
strsql4 = "delete from tbltemp"
DoCmd.SetWarnings False
DoCmd.RunSQL strsql
DoCmd.SetWarnings False
DoCmd.RunSQL strsql2
DoCmd.SetWarnings False
DoCmd.RunSQL strsql3
DoCmd.SetWarnings False
DoCmd.RunSQL strsql4
End Sub
在窗體中建個(gè)按鈕,按鈕事件中寫代碼如下:
Private Sub Command0_Click()
Dim strsql As String
Dim strsql2 As String
Dim strsql3 As String
Dim strsql4 As String
strsql = "select distinct 企業(yè)名稱,注冊(cè)地址,企業(yè)負(fù)責(zé)人,經(jīng)營(yíng)范圍 into tbltemp from InfoData"
strsql2 = "delete from InfoData "
strsql3 = "insert into InfoData select * from tbltemp"
strsql4 = "delete from tbltemp"
DoCmd.SetWarnings False
DoCmd.RunSQL strsql
DoCmd.SetWarnings False
DoCmd.RunSQL strsql2
DoCmd.SetWarnings False
DoCmd.RunSQL strsql3
DoCmd.SetWarnings False
DoCmd.RunSQL strsql4
End Sub

