vba - 运行时错误3021 - EOF或BOF为true或当前记录已被删除

时间:2016-03-25 14:30:21

标签: vba oledb

我写了下面的代号,但我在getIDKategori = rs!id_kategori

收到错误
Public Function getIDKategori(ByVal nama As String) As Integer
  Dim rs As New ADODB.Recordset
  Set rs.ActiveConnection = CurrentProject.Connection
  rs.Open "SELECT kategori.id_kategori FROM kategori WHERE nama_kategori='" & nama & "';"

  getIDKategori = rs!id_kategori
  rs.Close
  Set rs = Nothing
End Function

0 个答案:

没有答案