Article ID: 113592
Article Last Modified on 1/8/2003
113683 Fact Sheet on Microsoft Jet 2.0/VB 3.0 Compatibility Layer
113951 How to Obtain & Distribute the Compatibility Layer
Control Name Property New Value --------------------------------------------------------------- Label1 AutoSize True Label1 Caption Union Query Sample Command1 Caption Access 2.0 Nwind Sample Command2 Caption VB 3.0 Biblio(Access 1.x) Sample Data1 Visible False Data2 Visible False
Sub Command1_Click ()
' Build the Union query:
' Select all Companies from Suppliers and Customers in Brazil:
sql$ = "SELECT [Company Name] FROM Suppliers"
sql$ = sql$ & " WHERE Country = 'Brazil' UNION SELECT [Company Name]"
sql$ = sql$ & " FROM Customers WHERE Country = 'Brazil'; "
' Place the query in the recordsource and refresh the data control:
data1.DatabaseName = "C:\ACCESS2\SAMPAPPS\NWIND.MDB" '
data1.RecordSource = sql$
data1.Refresh
' Add records of the query to the list box:
Do Until data1.Recordset.EOF
list1.AddItem data1.Recordset("Company Name")
data1.Recordset.MoveNext
Loop
End Sub
Sub Command2_Click ()
' Build the Union query:
' Select all publishers where publishers and titles begin with 'm':
sql$ = "SELECT titles.pubid FROM titles "
sql$ = sql$ & " WHERE title like 'm*' UNION SELECT publishers.pubid"
sql$ = sql$ & " FROM publishers WHERE name like 'm*';"
' Initialize the data control:
data2.DatabaseName = "C:\VB3\BIBLIO.MDB" ' Change path if needed.
data2.RecordSource = sql$
data2.Refresh
' Add the results to the list box:
Do Until data2.Recordset.EOF
list2.AddItem data2.Recordset("pubid")
data2.Recordset.MoveNext
Loop
End Sub
Additional query words: 3.00
Keywords: KB113592