Validating Input depending on other table's field (1 Viewer)

Ramnik

Registered User.
Local time
Today, 23:11
Joined
Jul 12, 2012
Messages
145
Hello everyone,
in access 2007
I have a stock query which have fields as :
productid | quantity
group by | sum
abc | 1200
def | 1300
dfg | 1000

now i have another table like issue detail :
date | product id | quantity
1-1-2000 | abc | 1100
1-1-2000 | def | 1400

now how to validate the second product i.e. def as the quantity is more than available ?????????? it should be as issue.quantity < available.quantity
 

pr2-eugin

Super Moderator
Local time
Today, 18:41
Joined
Nov 30, 2011
Messages
8,494
Hello Ram, First you say that you have a StockQuery.. Then you have a table Issue_Detail.. So how do you want to validate? are you using a Form that is bound to the table and you want to validate the product when entering the quantity? Give a little bit more info.
 

Ramnik

Registered User.
Local time
Today, 23:11
Joined
Jul 12, 2012
Messages
145
i want to know if there is a possibility of validation when entering data directly in table .
if no possibility then lets suppose we have a data entry form so how to validate . is there any need of programming ?????????? thanks
 

pr2-eugin

Super Moderator
Local time
Today, 18:41
Joined
Nov 30, 2011
Messages
8,494
The validations that you will be able to do on a table level THAT I KNOW OF are only checking Length, numeric, Null, True/False etc. Not really sure of looking up values on other tables and queries.. So from me it is 'Not' possible.. But it sure is possible to do through the Form, you do need to do some Coding for that..

You have to do the following:
* Create a Bound Form to the table,
* On the BeforeUpdate event of the TextField which takes the value of Quantity, you need a simple If Condition. Which will use DLookUp to see the value in the Query. Something Along the way of
Code:
If Me.[Quantity] < DLookUp("Quantity","[Stock Query]","[Product ID]=" & Me.[Product ID]) Then
MsgBox("ERROR")
End If
* Then you can follow your procedure whatever you wish to.
 

Users who are viewing this thread

Top Bottom