Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
MSDN Visual Basic Community
 
 
 
 
 
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-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated