vba - 插入表格中的vba值和表格中的值
问题描述
我想要发生的是,我将来自联系人的 ID 附加到 Contact_Attendance,其中记录不是非活动的并且(这是问题区域)将 Text1 中的值放入 Contact_Attendance 上的 EffectiveDate 字段(日期/时间)
Option Compare Database
选项显式
Private Sub Command5_Click() Dim strSqlInsert As String Dim strsqlUpdate As String Dim Effectivedate As Date
strSqlInsert = "INSERT INTO contacts_attendance (contactID) SELECT ID from contacts where inactive = false;"
strsqlUpdate = "UPDATE contacts_attendance SET effectivedate = ' " & Text1 & "'"
DoCmd.SetWarnings False
DoCmd.RunSQL strSqlInsert
'I think I need a statement here to check if effectivedate is null (implies its a new insert) then only populate those records
'Need help writing it.
DoCmd.RunSQL strsqlUpdate
DoCmd.SetWarnings True
结束子
解决方案
推荐阅读
- python - z3py:符号表达式不能转换为具体的布尔值?
- laravel - 如何从laravel中的回调http post方法重试数据
- ios - 计算购物车中的总价
- c++ - 使用 GCC 和 Clang 构建 mediapipe 失败
- php - 如何通过汇总价格在 woocommerce 中获得正确的小计+总计?
- prometheus - 如何在 Prometheus 查询中设置返回样本频率?
- python - 如何使用 python pdfminer 将 pdf 转换为 HTML?
- android - MPAndroidChart - Y 轴标签绘制成两条线(太长时)
- python - 如何将值传递给 django 管理员更改列表模板?
- javascript - 退出 CLI 的问题