DoCmd.RunSQL _
"INSERT INTO dbo_TimerTable ( Minutes, ClientFirst, ClientLast, StartTime, EndTime, Reason, UserInitials, ClientID )" & _
"SELECT 30 AS Expr1, [Forms]![Daily Appearance Sheet Verified]![FirstName] AS Expr2, [Forms]![Daily Appearance Sheet Verified]![LastName] AS Expr3, Now() AS Expr4, Now() AS Expr5, "Letter to Client" AS Expr6, "MC" AS Expr7, [Forms]![Daily Appearance Sheet Verified]![ClientID] AS Expr8""
我试图将这个runql命令分成不同的行。我目前有这个命令在记录集上运行while循环。我似乎无法让这个SQL正常工作。感谢任何帮助,谢谢!
编辑:
DoCmd.RunSQL "INSERT INTO dbo_TimerTable " _
& "(Minutes, ClientFirst, ClientLast, StartTime, EndTime, Reason, UserInitials, ClientID ) VALUES" _
& "( 30, & [Forms]![Daily Appearance Sheet Verified]![FirstName], & [Forms]![Daily Appearance Sheet Verified]![LastName], Now(), Now(), " & "Letter to Client", "MC", [Forms]![Daily Appearance Sheet Verified]![ClientID]
我现在把我的代码更改为了这个,我只需要帮助形成值,我就会陷入何时放置&对于变量。再次感谢!
答案 0 :(得分:0)
这只是一个声明。你已经按照字面意思来设置控件的名称,需要像"30 as e1, " & [Forms]![Daily Appearance Sheet Verified]![FirstName] & "......
,'写给客户的信'和'MC'你可以使用VALUES (
而不是选择部分