Looks up a record in a database table and returns the ID of the record or NULL if the record does not exist.

lookupRecord(
  db,
  tableName,
  keyAssignments,
  idField = hsFields(db, tableName)[1],
  dbg = FALSE,
  use2007Driver = NULL
)

Arguments

db

full path to MS Access/Excel database or name of ODBC data source

tableName

name of table in which record is to be looked up

keyAssignments

key-value-assignments used to identify the record to be looked up. The assignments are defined in forms of a list, e.g. list(key1 = "value1", key2 = "value2").

idField

name of ID field, default: name of first table field

dbg

if TRUE, debug messages are shown

use2007Driver

passed to isMySQL