Microsoft Access VBA Macro Programming

(Tina Sui) #1
the SupplierSize drop-down is called Combo0), select the Change event in the drop-down in
the top-right corner of the code window. Enter the following code:

Private Sub Combo0_Change()
Dim strTemp As String
Me.Combo0.SetFocus
strTemp = Me.Combo0.text
Me.Combo2.SetFocus
Me.Combo2.RowSource = _
"select distinctSupplierName fromtblSupplierwhere SupplierSize='" _
& strTemp & "'"

If strTemp = "Small" Then
Me.Text4.Visible = False
Else
Me.Text4.Visible = True
End If

352 Microsoft Access 2010 VBA Macro Programming


Figure 39-3 The supplier form in Design mode
Free download pdf