|
|
Title | Combine fields in a SELECT statement |
Keywords | database, SELECT statement, combine |
Categories | Database, 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
|
|
|
|
|
|