Dim StartDate As Date = Date.Today().AddDays(-30) Dim cmdn As new SQLcommand cmdn.c cmdn.CommandText = "SELECT Count(唯一、无重复值列) From {Table1} where [日期] > '" & StartDate & "'" If cmdn.ExecuteScalar > 500 Then messagebox.show("累计完成目标500") Return End If