VBA无效。(点)或!分割数据库后的括号或括号

时间:2016-08-08 20:35:24

标签: vba ms-access

我有一个表格工作正常的数据库,但是现在我拆分数据库后发现错误:

使用无效。 (点)或!运算符或无效的括号。

这是调试器的目标代码

$

当我删除DoCmd.RunSQL ("Insert Into TestingStatistics (BadgeNumber, TestName, College, Instructor, SigninTime, Special) " & _ "Values ('" & Me.txtBadgeNo.Value & "', '" & strTestName & "', '" & strCollege & "', '" & strInstructor & "', Now(), '" & Me.chkSpecial.Value & "');") Me.txtBadgeNo.Value

Me.chkSpecial.Value

我收到错误:

查询表达式中的语法错误(缺少运算符)&#39; Medicine&#39;,&#39; Medicine,&#39; Larsen&#39;,Now());&#39;。< /强>

同样,这在我拆分数据库之前有效,我需要这个插入语句才能工作,这是怎么回事?

2 个答案:

答案 0 :(得分:0)

您不能只删除值;计数必须与字段数相匹配。

试试这个:

Dim SQL As String

SQL = _
    "Insert Into TestingStatistics (BadgeNumber, TestName, College, Instructor, SigninTime, Special) " & _
    "Values (" & Me!txtBadgeNo.Value & ", '" & strTestName & "', '" & strCollege & "', '" & strInstructor & "', Now(), " & Me!chkSpecial.Value & ");"

Debug.Print SQL

DoCmd.RunSQL SQL

编辑,调试:

#!/bin/bash
# alias.sh

shopt -s expand_aliases
# Must set this option, else script will not expand aliases.


# First, some fun.
alias Jesse_James='echo "\"Alias Jesse James\" was a 1959 comedy starring Bob Hope."'

echo;
echo

答案 1 :(得分:0)

“值(”&amp; strTestName&amp;“','”&amp; strCollege&amp;“','”&amp; strInstructor&amp;“','”&amp; Now()&amp;“');”)