How to access another table

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
 
T

Tim Ferguson

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top