Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
 
 
 
 
 
 
 
Old Pages
 
Old Index
Site Map
What's New
 
Books
How To
Tips & Tricks
Tutorials
Stories
Performance
Essays
Links
Q & A
New in VB6
Free Stuff
Pictures
 
 
 
TitleCombine fields in a SELECT statement
Keywordsdatabase, SELECT statement, combine
CategoriesDatabase, Tips and Tricks
 
Use + to concatenate the fields.

The following code combines the Title and ISBN fields into a single field called CombinedTitle. At design time, I set the form's first TextBox's DataField property to CombinedTitle so that control displays the Data control's CombinedTitle values.

 
Private Sub Form_Load()
    Data1.DatabaseName = App.Path & "\books.mdb"

    ' This SELECT statement combines the Title and
    ' ISBN fields into one CombinedTitle field.
    ' The parentheses are for looks.
    Data1.RecordSource = _
        "SELECT " & _
        "Title + ' (' + ISBN + ')' As CombinedTitle," & _
        "Year," & _
        "URL " & _
        "FROM BookInfo"
End Sub
 
 
Copyright © 1997-2003 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated