我经常的写法是:
dim sql as string(可以全局声明),textbh as string(如果要防止空值,就不要声明具体的数据类型只:dim textbh)
textbh=""& form_客户资料.编号.value &""
sql="delete * from [Khcs] where [bh]='"& textbh &"'"
'如果不用textbh,直接用form_客户资料.编号.value,空值就会出错
currentproject.connection.execute(sql)