无效使用 Me 关键字 [英] Invalid use of Me keyword

查看:46
本文介绍了无效使用 Me 关键字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这段代码是一个函数,而不是一个私有子程序.我突然收到这个错误.[此处的字段名称].我在其他代码中没有遇到那个错误,只是在这个代码中.这是我的完整代码,没有无聊的结尾部分,但我从行开始收到错误:

This code is a function and not a private subroutine. I'm suddenly getting this error with the Me.[field name here]. I'm not getting that error in my other code, just in this one. Here's my full code without the boring end part, but I'm getting the error starting from the line:

Me.assignedby.Column(1)

Public Function AssignNullProjects() As Long

    Dim db As dao.Database
    Dim rs As dao.Recordset
    Dim strSQL As String

    assignedby = TempVars("user").Value

    Set db = CurrentDb
    strSQL = "SELECT CFRRRID FROM CFRRR WHERE assignedto Is Null"
    Set rs = db.OpenRecordset(strSQL, dbOpenDynaset)
    If Not rs.BOF And Not rs.EOF Then
        While Not rs.EOF
            strSQL = "UPDATE CFRRR SET assignedto = " & GetNextAssignee & ", assignedby = " & Me.assignedby.Column(1) & ", Me.Dateassigned = #" & Now & "#, Me.actiondate = #" & Now & "#, Me.Workername = " & _
                              Me.assignedto.Column(0) & ", Me.WorkerID = " & Me.assignedto.Column(0) & " WHERE CFRRRID = " & rs!CFRRRID
            db.Execute strSQL, dbFailOnError
            rs.MoveNext
        Wend
    End If

    rs.Close
    db.Close
    Set rs = Nothing
    Set db = Nothing

上述错误的可能原因是什么,如何消除?

What could be the possible reason for the above-stated error, and how it could be removed?

推荐答案

将该代码放入表单的代码模块中.当您尝试在标准模块中使用 Me 时,您总是会收到 Invalid use of Me 关键字" 的抱怨.

Put that code in the form's code module. When you try to use Me in a standard module, you will always get that "Invalid use of Me keyword" complaint.

查看 Access 帮助系统中的Invalid use of Me keyword"Me "主题以了解更多详细信息.

Check out the "Invalid use of Me keyword" and "Me <keyword>" topics in Access' help system for further details.

这篇关于无效使用 Me 关键字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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