Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combo box starts Multiple Subforms 1

Status
Not open for further replies.

molly

Technical User
Jul 17, 2000
219
0
0
US
I have a main form with 3 subforms. The forms all worked well where the subform 1 is all our products, subform 2 is the customers who take a product in subform1, and then subform 3 is the order qty by location. It works great.

However, I just added a new dimension which kills me now.

I have a new combo box on the main form. It is called cboPickFLCid. I want to pull down a primary category number which will then TRIGGER the first subform box and make it ripple as usual.

I cannot get the cboPickFLCid to fire up and make the 3 subforms work again.

Attached in box.net is a shorty file. I call it car parts.
Please refer to the red combo box in the upper left area which is my selection but it does not fire up.

This is a hard one, so I will donate later. See File
Thanks
Molly
 
In subform 8410sfrm Sku Prime:

LinkMasterField:cboPickFLCid
 
Maj to the rescue again. I was so close yet so far. Thanks for the answer. It works.

Molly.
 
In the same red FLC field. There is an flc code "0" or zero, when I want ALL flc records to appear. How can you program it to show me all records when I pick zero?

None of the records will have a zero, so i suppose that you need a vba statement to say that zero means ALL.This way, i can be selective and choose just 1 FLC code like 083 or I can pick 0 to get all the records.

I assume that you have the same sample database and made the earlier fix. Molly
 
In the "8410Qry Sku Prime" query, I'd replace this:
WHERE (((tblSkuPrime.FLCid)=Forms![8405frm SKU Main]!cboPickFLCid))
with this:
WHERE tblSkuPrime.FLCid=Forms![8405frm SKU Main]!cboPickFLCid OR Forms![8405frm SKU Main]!cboPickFLCid=0

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
You actually had two things going on. Pick one or the other.

Method 1: You had code to handle the form requery, and critieria in your sql statement to handle the filtering.

Method2: You tried doing the same thing by linking the subform with the combo

These two are in conflict. Lets go with method 1.
1) Remove the child master link in the first subform
2)Change the code
Code:
Private Sub cboPickFLCid_AfterUpdate()
    
 On Error GoTo Form_Current_Err
    Me.[8410sfrm Sku Prime].Requery
    Me.[8414sfrm Customer Group].Requery
    Me.[8416sfrm Customer Detail].Requery
    
  Exit Sub
Form_Current_Err:
   If Not (Err.Number = 0) Then MsgBox Err.Description
End Sub
The original code is all jacked up.

3) Then in the query for the 1st subform add this to the criteria:
[Forms]![8405frm SKU Main]![cboPickFLCid] Or [Forms]![8405frm SKU Main]![cboPickFLCid]="0"

so if the combo = "0" it returns true, thus all records.

It appears your FLCis is numeric saves as text.
 
Also do yourself a favor. You use a pretty good naming convention, but remove all spaces from any table, field, or object name. This will save you code and reduce error. You will no longer need brackets

frmSomeFormName
not
frm Some Form Name

then
forms!frmSomeFormName
and no longer required to do
forms![frm Some Form Name]

and it will not crash your code. Yes MS allows spaces, but it should not.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top