Function strget()
Dim rs As New ADODB.Recordset
Dim STR As String
rs.Open "select 源表字段 from 源表", CurrentProject.Connection
STR = rs.GetString(adClipString, , , ";")
strget = Left(STR, Len(STR) - 1)
End Function
建个表,将表字段设成“索引(不重复)”,然后运行一段代码:
Private Sub CommandButton_Click()
arr = Split(strget, ";")
For Each ar In arr
DoCmd.SetWarnings False
DoCmd.RunSQL "insert into 新表(字段) select '" & ar & "'"
DoCmd.SetWarnings True
Next
MsgBox "set OK!"
End Sub