Data Validation Question

Toffy

Registered User.
Local time
Today, 21:51
Joined
Nov 18, 2013
Messages
10
Hi there very new access user and im sure this is a very simple question.

Basically in my order details table i have the following fileds
Product
Unit
Size

At the moment i have the Product field with a dropdown that gives me all the products from my ProductT. But once i choose the correct product in the unit field it gives me all the possibilities of every product not just the units associated with that product. ie

ProductT
Grasshopper Box1000 Adult
Grasshopper Box1000 Subadult
Worm 10pz Big

when i select the grasshopper product and move on to the unit field i also get "10pz" option but this is not a product available.

How do i set up validation of the fields Unit and size based on another fields data?:banghead:
 
Search the forum for for "cascading combo".
 
Hi there very new access user and im sure this is a very simple question.

Basically in my order details table i have the following fileds
Product
Unit
Size

At the moment i have the Product field with a dropdown that gives me all the products from my ProductT. But once i choose the correct product in the unit field it gives me all the possibilities of every product not just the units associated with that product. ie

ProductT
Grasshopper Box1000 Adult
Grasshopper Box1000 Subadult
Worm 10pz Big

when i select the grasshopper product and move on to the unit field i also get "10pz" option but this is not a product available.

How do i set up validation of the fields Unit and size based on another fields data?:banghead:

You need to create a procedure

Code:
Private Sub UpdateUnit()
' protect against Null
If isNull(Me!Product) Then Exit Sub
' 
Me!Unit.RowSource = "SELECT Unit FROM ProductT WHERE Product = " & Me!Product
Me!Unit.Requery
End Sub
and call it from On_Current and Product_After_Update Events. This should do the trick assuming that the field names are correct. If this doesn't work copy the original Unit.RowSource text and send it back.

Best,
J.
 
Private Sub ComboArticolo_AfterUpdate()
On Error Resume Next
ComboTaglia.RowSource = "Select ProdotiPescaT.Taglia " & _
"FROM ProdotiPescaT " & _
"WHERE ProdotiPescaT.NomeProdoto = '" & ComboArticolo.Value & "' " & _
"ORDER BY ProdotiPescaT.Taglia;"
On Error Resume Next
ComboUnita.RowSource = "Select ProdotiPescaT.Unita " & _
"FROM ProdotiPescaT " & _
"WHERE ProdotiPescaT.NomeProdoto = '" & ComboArticolo.Value & "' " & _
"ORDER BY ProdotiPescaT.Unita;"
End Sub

This is what i have so far it seems to work but not totally the way im looking for yet.
I need the 3rd cascading combo box to look at the previous 2 and give me the options possible, at the moment it just looks at the first combo box...
 

Users who are viewing this thread

Back
Top Bottom