home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Programmer'…arterly (Limited Edition) / Visual_Basic_Programmers_Journal_VB-CD_Quarterly_Limited_Edition_1995.iso / code / ch06code / listings / 06list03.txt < prev    next >
Text File  |  1995-08-10  |  1KB  |  28 lines

  1. Listing 6.3[em]How To Access the Value of a Calculated Field and How To Name the Field
  2. '********************************************
  3. 'Set up the SELECT statement without the name
  4. '********************************************
  5. Dim NewDyn As RecordSet
  6. SQL = "SELECT Lastname & ', ' & Firstname FROM Customers"
  7. '****************************************
  8. 'Create a Dynaset from the SQL statement
  9. '****************************************
  10. NewDyn = OldDb.OpenRecordset(SQL)
  11. '**********************************
  12. 'Get the value of the created field
  13. '**********************************
  14. Person = NewDyn.Recordset(0)
  15. '**********************************************************
  16. 'Set up the SELECT statement and assign a name to the field
  17. '**********************************************************
  18. SQL = "SELECT Lastname & ', ' & Firstname As Name FROM Customers"
  19. '****************************************
  20. 'Create a Dynaset from the SQL statement
  21. '****************************************
  22. NewDyn = OldDb.OpenRecordset(SQL)
  23. '**********************************
  24. 'Get the value of the created field
  25. '**********************************
  26. Person = NewDyn.Recordset("Name")
  27.  
  28.