DAO and seek
I have two questions in regards to the below example that can be found on page 170.
1. On the second to last line it says 'rs.CustName'. Now where does rs come from and what does it mean? Is it a misspelling of 'rst'??
2. I assume that CustName is a name of one of the fields in the table. I get an error message when I try to separate the recordset and a field with a dot (rst.CustomerId) but it works if I use an exclamation mark (rst!CustomerId). Why is this? I cant see what i am doing different that what they are doing in the book.
Help will be very appreciated!
Example:
'Open the database that contains the table that is linked
Set dbs = OpenDatabase(strMyExternalDatabase)
'Open a table-type recordset against the external table
Set rst = dbs.OpenRecordset("tblCustomers", dbOpenTable)
'Specify which index to search on
rst.Index = "CustomerNo"
'Specify the criteria
rst.Seek "=", 123
'Check the result
If rst.NoMatch Then
MsgBox "Record not found."
Else
MsgBox "Customer name: " & rs.CustName
End If
|