E
EddieLampert
Good day,
I have a button in a form that is supposed to link to a combo box. In the
combo box, I have "sectors" pulled from a table. Each sector has many
companies, so I want it to where I hit the button and pulls up all the
companies that are in the sector that is displayed in the combo box. Here is
the code. Any help is appreciated.
Private Sub cmdGetSectors_Click()
On Error GoTo Err_cmdGetSectors_Click
Dim varWhere As Variant
Dim rst As DAO.Recordset
Const qts As String = ""
If Not IsNull(Me.comSectors) Then
varWhere = "[Target Sector]=" & qts & Me![comSectors] & qts
DoCmd.OpenForm "frmDeals", acFormDS, , varWhere
Forms!frmDeals.SetFocus
Else
MsgBox "Please select a sector.", vbCritical, gstrAppTitle
Exit Sub
End If
Exit_cmdGetSectors_Click:
Exit Sub
Err_cmdGetSectors_Click:
If Err.Number = 2501 Then Resume Exit_cmdGetSectors_Click
MsgBox Err.Description
Resume Exit_cmdGetSectors_Click
End Sub
Private Sub Detail_Click()
End Sub
Private Sub GetSectors_Click()
End Sub
I have a button in a form that is supposed to link to a combo box. In the
combo box, I have "sectors" pulled from a table. Each sector has many
companies, so I want it to where I hit the button and pulls up all the
companies that are in the sector that is displayed in the combo box. Here is
the code. Any help is appreciated.
Private Sub cmdGetSectors_Click()
On Error GoTo Err_cmdGetSectors_Click
Dim varWhere As Variant
Dim rst As DAO.Recordset
Const qts As String = ""
If Not IsNull(Me.comSectors) Then
varWhere = "[Target Sector]=" & qts & Me![comSectors] & qts
DoCmd.OpenForm "frmDeals", acFormDS, , varWhere
Forms!frmDeals.SetFocus
Else
MsgBox "Please select a sector.", vbCritical, gstrAppTitle
Exit Sub
End If
Exit_cmdGetSectors_Click:
Exit Sub
Err_cmdGetSectors_Click:
If Err.Number = 2501 Then Resume Exit_cmdGetSectors_Click
MsgBox Err.Description
Resume Exit_cmdGetSectors_Click
End Sub
Private Sub Detail_Click()
End Sub
Private Sub GetSectors_Click()
End Sub