How to access another table

  • Thread starter Thread starter mac
  • Start date Start date
M

mac

My database is in SQL2K and frontend is in VFP.

I have standard software and this software allows users to use VBAe to do
the modifications.

Here is a scenerio, user enters a part number in a text box. I need to take
that part number and search it in a able ABC. If found then display,
Description, Quantity on hand, Price, etc. etc......

How do I open a table and read the record ?

Thanks
 
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
 
Back
Top