In my Access2000 .MDB database I use this sort of structure all over
the place (How do I replace it in my Access2000 .ADP database?):
Dim db as Database
Dim rs as DAO.Recordset
Dim strSQL as String
Dim myUniqueID as Long
Dim myExtract as Long
strSQL = "Select myTableName.myIDField, myTableName.myTextField " & _
"From myTableName " & _
"WHERE (((myTableName.MyIDField) = " & myUniqueID & ")))"
Set db = CurrentDB()
Set rs = db.OpenRecordset(strSQL, dbOpenSnapshot)
If Not rs.BOF and Not rs.EOF Then ' it has records
myExtract = rs.("myTextField")
' run some code here using myExtract
End if
I can't move foward with a major project until I can at least
understand this!
Any help is GREATLY appreciated.
lq