我正在使用访问数据库,当我删除任何记录时,它不会刷新此gridview它会给出错误
'访问'没有宣布。由于其保护级别,它可能无法访问
Public Sub RefreshGrid()
' RUN QUERY
Access.ExecQuery("SELECT * FROM Members ORDER BY username ASC")
' REPORT & ABORT ON ERRORS
If NoErrors(True) = False Then Exit Sub
' FILL DATAGRID
dgvData.DataSource = Access.DBDT
' CLEAR COMBOBOX
cbxUsers.Items.Clear()
' FILL COMBOBOX
For Each R As DataRow In Access.DBDT.Rows
cbxUsers.Items.Add(R("username"))
Next
' DISPLAY FIRS NAME FOUND
If Access.RecordCount > 0 Then cbxUsers.SelectedIndex = 0
End Sub
答案 0 :(得分:0)
我认为你正在调用Function" RefreshGrid"它无法访问变量" Access",使Access公开或在" RefreshGrid"内重新声明它。功能