为什么我得到运行时错误3464(条件表达式中的数据类型不匹配)的任何想法?
我的sql代码是:
MySql1 = "UPDATE Thaw_Tags SET [Pulled_item]='" & Me.Text162 & "'," _
& "[fordate]='" & Me.Text164 & "',[Midnight_Meat]='" & Me.Combo168.Column(1) & "',[Midnight_Meat_Required]='" & Me.Combo200 & "',[Midnightserving_size]='" & Me.Text227 & "'," _
& "[Midnighttotal_servings]='" & Me.Text170 & "',[Breakfast_Meat]='" & Me.Combo172.Column(1) & "',[Breakfast_Meat_Required]='" & Me.Combo202 & "',[Breakfastserving_size]='" & Me.Text230 & "'," _
& "[Breakfasttotal_servings]='" & Me.Text174 & "',[Lunch1_Meat]='" & Me.Combo176.Column(1) & "',[Lunch1_Meat_Required]='" & Me.Text212.Value & "'," _
& "[Lunch1serving_size]='" & Me.Text233 & "',[Lunch1total_servings]='" & Me.Text178.Value & "',[Lunch2_Meat]='" & Me.Combo180.Column(1) & "',[Lunch2_Meat_Required]='" & Me.Text216 & "'," _
& "[Lunch2serving_size]='" & Me.Text237 & "',[Lunch2total_servings]='" & Me.Text182 & "',[Lunch3_Meat]='" & Me.Combo184.Column(1) & "',[Lunch3_Meat_Required]='" & Me.Text220 & "'," _
& "[Lunch3serving_size]='" & Me.Text241 & "',[Lunch3total_servings]='" & Me.Text186 & "',[Dinner1_Meat]='" & Me.Combo188.Column(1) & "',[Dinner1_Meat_Required]='" & Me.Text214 & "',[Dinner1serving_size]='" & Me.Text235 & "'," _
& "[Dinner1total_servings]='" & Me.Text190 & "',[Dinner2_Meat]='" & Me.Combo192.Column(1) & "',[Dinner2_Meat_Required]='" & Me.Text218 & "', [Dinner2serving_size]='" & Me.Text239 & "',[Dinner2total_servings]='" & Me.Text194 & "'," _
& "[Dinner3_Meat]='" & Me.Combo196.Column(1) & "',[Dinner3_Meat_Required]='" & Me.Text222 & "',[Dinner3serving_size]='" & Me.Text243 & "',[Dinner3total_servings]='" & Me.Text198 & "'" _
& "WHERE [Day]='" & Me.Combo160 & "'"
Debug.Print MySql1
DoCmd.RunSQL MySql1
在调试打印时:
UPDATE Thaw_Tags SET [Pulled_item]='4/10/2018',[fordate]='4/13/2018',[Midnight_Meat]='Asian BBQ Turkey',[Midnight_Meat_Required]='TURKEY BREAST BONELESS',[Midnightserving_size]='1.25',[Midnighttotal_servings]='25',[Breakfast_Meat]='Asian Bourbon Beef & Vegetables over Noodles',[Breakfast_Meat_Required]='BEEF GROUND 90/10',[Breakfastserving_size]='0.625',[Breakfasttotal_servings]='30',[Lunch1_Meat]='Baked Chicken',[Lunch1_Meat_Required]='CHICKEN 1/4 CUT',[Lunch1serving_size]='1',[Lunch1total_servings]='35',[Lunch2_Meat]='Baked Turkey and Noodles',[Lunch2_Meat_Required]='Turkey Roll',[Lunch2serving_size]='1.15',[Lunch2total_servings]='45',[Lunch3_Meat]='Asian Bourbon Beef & Vegetables over Noodles',[Lunch3_Meat_Required]='BEEF GROUND 90/10',[Lunch3serving_size]='0.625',[Lunch3total_servings]='55',[Dinner1_Meat]='Baked Dijon Pork Chop',[Dinner1_Meat_Required]='PORK LOIN CHOPS',[Dinner1serving_size]='1.5625',[Dinner1total_servings]='40',[Dinner2_Meat]='Asian BBQ Turkey',[Dinner2_Meat_Required]='TURKEY BREAST BON
ELESS', [Dinner2serving_size]='1.25',[Dinner2total_servings]='50',[Dinner3_Meat]='Baked Chicken',[Dinner3_Meat_Required]='CHICKEN 1/4 CUT',[Dinner3serving_size]='1',[Dinner3total_servings]='60'WHERE [Day]='7'
从我在调试中看到的一切看起来都不错......
答案 0 :(得分:1)
由于您只有一个条件表达式,即它。
WHERE [Day]='7'
应该是
WHERE [Day]=7
一旦你解决了这个问题,你就会遇到很多类似的错误。有许多字段听起来像数字字段,但您有单引号值。