运行时间错误3061:预计1 [英] RUN-TIME ERROR 3061: Expected 1

查看:79
本文介绍了运行时间错误3061:预计1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到此代码的问题,我不知道从哪里编辑。我想使用文本框中的值更新表中的记录。请帮助任何人。插入部件工作得很好。但更新不是。请帮帮我。

I am having problem with this code and I don't know where to edit from. I want to update records in the table using values in my textbox. Please help out anyone. The insert part is working very well. But the update is not. Please help me out.

'当我们点击按钮添加有两个选项

'1。 for Insert

'2。更新

如果是Me.MODULEID.Tag& "" =""然后

'这是用于插入新的$
'向表添加数据

CurrentDb.Execute" INSERT INTO tblModules(ModuleID,CourseCode,CourseTitle ,ModuleNo,起始日期,结束日期,StudyCentre,主持人)" &安培; _
$
    "VALUES(& Me.MODULEID&","& Me.COURSECODE&"','"& Me.COURSETITLE&"','"& Me .MODULENO&"','"& Me.StartDate&"','"& _

    Me.EndDate&"' ,'"& Me.StudyCentre&"','"& Me.Facilitator&"')"
'when we click on button Add there are two options
'1. for Insert
'2. for Update
If Me.MODULEID.Tag & "" = "" Then
'this is for insert new
'add data to table
CurrentDb.Execute "INSERT INTO tblModules(ModuleID,CourseCode,CourseTitle,ModuleNo,StartDate,EndDate,StudyCentre,Facilitator)" & _
    "VALUES(" & Me.MODULEID & ",'" & Me.COURSECODE & "','" & Me.COURSETITLE & "','" & Me.MODULENO & "','" & Me.StartDate & "','" & _
    Me.EndDate & "','" & Me.StudyCentre & "','" & Me.Facilitator & "')"

推荐答案

该错误表示存在无法识别的字段名称。检查列和表单名称以确保没有拼写错误。另外,请注意缺少的空格:

The error indicates that there is a field name that cannot be identified. Check the column and Form names to make sure that you do not have a spelling error. Also, watch out for missing spaces:

 ",Facilicator='" & Me.Facilitator.Value & "'" & _
     " WHERE ModuleID=" & Me.MODULEID.Tag


这篇关于运行时间错误3061:预计1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆