Ms access 运行时错误';3061';只需要几个参数。预计1-2013年进入

Ms access 运行时错误';3061';只需要几个参数。预计1-2013年进入,ms-access,vba,ms-access-2010,ms-access-2013,Ms Access,Vba,Ms Access 2010,Ms Access 2013,/*行集合recSet1=con1.OpenRecordset(sql、dbOpenDynaset、dbSeeChanges)中出错*/ /*我应该写什么参数?错误3061*/ If recSet1.RecordCount > 0 Then 'user does exist in database MsgBox "You can access the application" Else 'user does not exist

/*行集合recSet1=con1.OpenRecordset(sql、dbOpenDynaset、dbSeeChanges)中出错*/

/*我应该写什么参数?错误3061*/

    If recSet1.RecordCount > 0 Then
        'user does exist in database
        MsgBox "You can access the application"
    Else
        'user does not exist
        MsgBox "Your login details do not match"
    End If    'recordcount
    recSet1.Close
    con1.Close
    Set wk = Nothing
    Set con = Nothing
    Set recSet1 = "Nothing enter code here"
End If

/*这是access 2013*中验证登录的代码?

您的SQL无法看到您的VBA参数。试着这样做:

sql = "SELECT NIK, Pass FROM Tb_Peg WHERE NIK = '" & txNIK.Text & "'"
作为额外的预防措施,如果
txNIK
应该是一个数字(整数或长),我建议您明确声明变量:

Dim txNIK As Integer ' or Long
如果该值是一个字符串(正如我在上面的查询建议中所假设的),那么您应该在查询中用单引号括起该值

Dim txNIK As Integer ' or Long