"mac" <(E-Mail Removed)> wrote in
news:r_nyc.8728$(E-Mail Removed):
>
> How do I open a table and read the record ?
>
>
' you only want one record
strSQL = "SELECT * FROM abc WHERE PartNumber = " & dwGetPartNumber
' open it read only
Set rs = db.OpenRecordset(strSQL, dbOpenSnapshot, dbForwardOnly)
If rs.EOF Then
' oh dear, it wasn't there
MsgBox "Some Useful Error Message Here", etc
Else
' okay, get the values: use a With block for speed and ease of
' typing if you like
dwSerialNumber = rs!Serial
strDescription = rs!Description
dtLastUpDated = rs!LastUpdate
' etc
End If
rs.Close
Hope that helps. This is the DAO version; the ADO is similar but opens the
recordset on a connection object rather than a database, and the parameters
are a bit different.
B Wishes
Tim F
|