19.12.2012 Views

Computer Programming Concepts and Visual Basic David I. Schneider

Computer Programming Concepts and Visual Basic David I. Schneider

Computer Programming Concepts and Visual Basic David I. Schneider

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

1995 populations. When the second comm<strong>and</strong> button is pressed, the cities are presented in alphabetical<br />

order along with their currencies.<br />

Object Property Setting<br />

Private Sub cmdOrderByPop_Click()<br />

Dim strSQL As String<br />

txtCurrency.DataField = “”<br />

txtCurrency.Text = “”<br />

strSQL = “SELECT * FROM Cities ORDER BY pop1995 ASC”<br />

datCities.RecordSource = strSQL<br />

datCities.Refresh<br />

End Sub<br />

Private Sub cmdQuit_Click()<br />

End<br />

End Sub<br />

Private Sub cmdShowCurrency_Click()<br />

Relational Databases <strong>and</strong> SQL 335<br />

frmDBMan Caption Database<br />

Management<br />

cmdOrder Caption Order by<br />

ByPop Population<br />

cmdShow Caption Show<br />

Currency Currency<br />

cmdQuit Caption Exit<br />

datCities Caption Large World Cities<br />

Database MEGACTY2.MDB<br />

Name<br />

Record Cities<br />

Source<br />

lblCity Caption City:<br />

txtCity Data datCities<br />

Source<br />

DataField city<br />

Text (blank)<br />

lblCountry Caption Country:<br />

txtCountry Data datCities<br />

Source<br />

DataField country<br />

Text (blank)<br />

lblPopulation Caption 1995<br />

Population:<br />

txtPopulation Data datCities<br />

Source<br />

DataField pop1995<br />

Text (blank)<br />

lblCurrency Caption Currency:<br />

txtCurrency Data datCities<br />

Source<br />

Text (blank)<br />

Dim strSQL As String<br />

strSQL = “SELECT city, Cities.country, Cities.pop1995, currency ” & _ “FROM<br />

Cities INNER JOIN Countries ” & _ “ON<br />

Cities.country=Countries.country “ & ”ORDER BY city ASC”<br />

datCities.RecordSource = strSQL<br />

datCities.Refresh txtCurrency.DataField = “currency”<br />

End Sub

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!