my combo boxes

  • Thread starter Thread starter Revned
  • Start date Start date
R

Revned

Hi,

I have 2 unbound combo boxes in my main form frmMasterListDetails

Combo box 1

Name: PONo
RowSourceType:Table/Query
RowSource: SELECT qryMasterList.PO, qryMasterList.Trigram FROM qryMasterList
GROUP BY PO, Trigram;

Column Count: 2
Bound Column: 1

I try this Event procedure in Combo box 1

Private Sub PONo_AfterUpdate()
Me.Equipment2.RowSource = "SELECT Equipment FROM" & _
" qryMasterList WHERE PONo = " & Me.Equipment & _
" ORDER BY Equipment"
Me.Equipment2 = Me.Equipment2.ItemData(0)


Combo box 2
Name:Equipment2
RowSourceType:Table/Query
ColumnCount;2
BoundColumn;1

But it doesn't work at all, when I select from my PONo combo box
it does not gives me a list of equipment in my combo box 2, it leaves blank.

Please can anyone is kind to help me how to figure out or maybe i got
a wrong in my VBA becuase I just copied it from samples and replace some
name fields? I might be wrong in replacing the field names?

Please can anyone is kind to help me

Thanks in advance
 
Daryl S,

Here is my SQL for my qryMasterList
SELECT tblMasterList.Trigram, tblMasterList.[TYPE OF DTB],
tblMasterList.[DATA BOOKS CONTRACTO DOC No], tblMasterList.PO,
tblMasterList.Equipment, tblMasterList.RFSU, tblMasterList.Deleted,
tblMasterList.POItems
FROM tblMasterList;

Yes I pull out data from a same query qryMasterList
in my table I set the
fieldname PO to Text data type
fieldname Equipment to Text data type

I have a situation here where some of my PO having to Equipment
So from my two Combo boxes PONo and Equipment
I want that after selects from my combo PONo my second combo it limits the
equiment used by a certain PO...

I place my combo PONo in Form Header in mainform
my combo Equipment I place it in under Detail in mainform

Daryl S,

Thank you very much for being kind

I try your suggestions but no luck....
 
Revned -

Since your qryMasterList uses the fieldname PO, I changed that in the code
below. The combobox name is left as PONo. Try this:

Private Sub PONo_AfterUpdate()
Me.Equipment2.RowSource = "SELECT Equipment FROM" & _
" qryMasterList WHERE PO = " & Me.PONo.Column(1) & _
" ORDER BY Equipment"
Me.Equipment2 = Me.Equipment2.ItemData(0)
 
Back
Top