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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dependant combo box & sub form

Status
Not open for further replies.

bruno1

Technical User
Dec 10, 2005
8
ES
I Have 2 dependent combo boxes Product & Group on a form Factura details. Each are bound to tbls Products & Groups. The Row source are set as follows

Product
SELECT Products.ProductID, Products.ProductName FROM Products ORDER BY [ProductName];
Group
SELECT Groups.FamilyID, Groups.Family, Groups.ProductID FROM Groups WHERE (((Groups.ProductID)=Forms!facturas![Facturas details]!Product)) ORDER BY Groups.Family;

The form is a sub form of Facturas with the following code

Private Sub Form_Current()
Me.group.Requery
End Sub

Private Sub Form_Load()
If IsNull(Product) Then
Me.Product = Me.Product.ItemData(0)
Call Product_AfterUpdate
End If
End Sub

Private Sub group_BeforeUpdate(cancel As Integer)

End Sub

Private Sub group_GotFocus()
Me.group.Dropdown
End Sub

Private Sub Product_AfterUpdate()
Me.group = Null
Me.group.Requery
Me.group = Me.group.ItemData(0)
End Sub

Private Sub Product_GotFocus()
Me.Product.Dropdown
End Sub

My problems are
The dependant combo box resets to blank if I enter more than one record., but the tbl Facturas details records it, if I only enter one record the table does not record it.

My 2nd problem is if I enter The following in theRow source of Cmbo Group
Forms![Facturas details]!Product)
The Facturas details form will open but the Facturas form wants the parameter as written.
If I add a reference to the main form then the reverse happens
Forms!Facturas![Facturas details]!Product)
Main form with sub form opens but factura details wants the parameter.

Please can anyone see what I am doing wrong ?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top