Help with frmCombo Code

  • Thread starter jahoff3 via AccessMonster.com
  • Start date
J

jahoff3 via AccessMonster.com

I am trying to create a form that feeds off of one query. There are two
combo boxes, and depending the options selected, results are listed in a list
box below. I have the following Code setup, however, nothing happens on my
form. I am new at this, so if additional information is needed, please let
me know.

Option Compare Database
Option Explicit

Const strSQL1 = "SELECT Collection.Analyst, Analyst.Extension, Collection.
Manager, Manager.Extension " & "FROM qryCombo1 WHERE Territory = "
Const strSQL2 = " AND Broker = "
Private strSQL As String

Const strMsg1 = "Select a territory from the list"
Const strMsg2 = "Select a broker from the list"

Private Sub cboTerritory_AfterUpdate()
If Me!cboBroker.Value > 0 Then Call FillList
End Sub

Private Sub cboBroker_AfterUpdate()
If Me!cboTerritory.Value <> " " Then Call FillList
End Sub

Private Sub cboStatus_AfterUpdate()
End Sub

Private Sub FillList()
strSQL = strSQL1 & Me!cboTerritory.Value & strSQL2 & Me!cboBroker.Value
Me!lblList.RowSource = strSQL
Me!lblList.Requery
End Sub

Private Sub Form_Activate()
If Me!cboTerritory.Value <> " " And Me!cboBroker.Value > 0 Then Call FillList
End Sub
 
N

NTC

if you want a form to open to data based on 2 combo boxs' values; one way is
a Main Form and a subform

the Main Form is just for the 2 combo boxes in the header

build a query and put their criterias to be from the main form's 2 comboboxes

build a new form based on the query

insert the new form as a subform, unbound, in the main form.....

you probably will have to refresh/requery the subform upon selection of a
new value in the combo box....
 
J

jahoff3 via AccessMonster.com

Sorry, this does not help. Anyone else have any suggestions???
if you want a form to open to data based on 2 combo boxs' values; one way is
a Main Form and a subform

the Main Form is just for the 2 combo boxes in the header

build a query and put their criterias to be from the main form's 2 comboboxes

build a new form based on the query

insert the new form as a subform, unbound, in the main form.....

you probably will have to refresh/requery the subform upon selection of a
new value in the combo box....
I am trying to create a form that feeds off of one query. There are two
combo boxes, and depending the options selected, results are listed in a list
[quoted text clipped - 33 lines]
If Me!cboTerritory.Value <> " " And Me!cboBroker.Value > 0 Then Call FillList
End Sub
 
J

jahoff3 via AccessMonster.com

Okay....how do I write the refresh/requery code?
if you want a form to open to data based on 2 combo boxs' values; one way is
a Main Form and a subform

the Main Form is just for the 2 combo boxes in the header

build a query and put their criterias to be from the main form's 2 comboboxes

build a new form based on the query

insert the new form as a subform, unbound, in the main form.....

you probably will have to refresh/requery the subform upon selection of a
new value in the combo box....
I am trying to create a form that feeds off of one query. There are two
combo boxes, and depending the options selected, results are listed in a list
[quoted text clipped - 33 lines]
If Me!cboTerritory.Value <> " " And Me!cboBroker.Value > 0 Then Call FillList
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top