Skip to content

Instantly share code, notes, and snippets.

@goliver79
Last active August 29, 2015 13:56
Show Gist options
  • Save goliver79/8821748 to your computer and use it in GitHub Desktop.
Save goliver79/8821748 to your computer and use it in GitHub Desktop.
[MSACCESS] Database Query and Recordset
Dim db As Database
Dim rs As Recordset
Dim sql As String
Dim id as Integer
id = 20
sql = "SELECT * FROM MyTable " & _
"WHERE id = " & id
Set db = CurrentDb
Set rs = db.OpenRecordset(sql)
If Not (rs.EOF And rs.BOF) Then
'id found!!
log rs!name
End If
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment