2 xuqing888 XUQING888 于 2017.09.04 10:14 提问

VBA连接access,Rscategories.Open提示至少一个参数未被指定值。

刚刚接触access的vba,遇到了点问题,希望得到指点和帮助

    Option Compare Database
    Dim conn As ADODB.Connection
    Dim rsbook As ADODB.Recordset
    Dim Rscategories As ADODB.Recordset

    Dim sqlstr As String
    Dim categories_code As Integer

    '创建对象

    Private Sub Form_Load()

    Set conn = CurrentProject.Connection
    Set rsbook = New ADODB.Recordset
    rsbook.locktype = adlockoptimistic
    rsbook.Open "图书档案", conn, , , adCMDTable

    End Sub

    Private Sub new_set_Click()

    If rsbook.BOF = True And rsbook.EOF = True Then '数据集为空时
    MsgBox ("数据表为空!")
    Else
    rsbook.MoveLast
    End If

    Set Rscategories = New ADODB.Recordset
    sqlstr = "SELECT 种类编号.编号 FROM 种类编号 WHERE (((种类编号.种类名称)=[Forms]![数据录入]![categories]))"
    Rscategories.Open sqlstr, conn, 1, 3
    MsgBox (Rscategories!编号)

    End Sub

1个回答

XUQING888
XUQING888   2017.09.04 11:10

发动自顶大法,跪求老司机解答。

Csdn user default icon
上传中...
上传图片
插入图片