Creating Criteria For Data Entry


S

Shane01

I am creating a database for my Fleet Dept. and have made two tables for
parts inventory. One of those tables is for the parts received and the other
table is for the parts that have been used in the Fleet Dept.. Now the
problem I'm having is that I want to create a form that will not allow a data
entry user to enter a quantity in the Parts used field without there being
parts available in the parts received table quantity on hand field.
 
Ad

Advertisements

A

Arvin Meyer [MVP]

Shane01 said:
I am creating a database for my Fleet Dept. and have made two tables for
parts inventory. One of those tables is for the parts received and the
other
table is for the parts that have been used in the Fleet Dept.. Now the
problem I'm having is that I want to create a form that will not allow a
data
entry user to enter a quantity in the Parts used field without there being
parts available in the parts received table quantity on hand field.

In the AfterUpdate event of the textbox which holds the parts used, do a
DCount of the part, and make sure the that the part exists in >= quantity.
 
S

Shane01

Thank You for your help Arvin. I have tried the Dcount in the form on the
field for quantity used properties afterupdate.Whenever I try this it seems
like it won't save to the form. I also tried to use the >= expresion in a
query and have not had any success so far. This is how I'm creating the the
expression >=, [PartsInventory]![QuantityOnHand] and I'm getting the error
message of an invalid syntax when I try to run this. if you can possibly give
me a little more insight it would be greatly appreciated. Thank You!
 
Ad

Advertisements

A

Arvin Meyer [MVP]

With a query, you would have to refer to the form explicitly:
= [Forms]![PartsInventory]![QuantityOnHand]

To save the results of the DCount (your shouldn't need to, because you can
always recalculate) you must set a bound textbox control equal to the
variable in the DCount:

Dim x
x= DCount( whatever ...)

If x <= txtOrderQty Then
MsgBox " You ain't got enough"
Else
Me.txtToSave = x
End If

or something to that effect.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


Shane01 said:
Thank You for your help Arvin. I have tried the Dcount in the form on the
field for quantity used properties afterupdate.Whenever I try this it
seems
like it won't save to the form. I also tried to use the >= expresion in a
query and have not had any success so far. This is how I'm creating the
the
expression >=, [PartsInventory]![QuantityOnHand] and I'm getting the error
message of an invalid syntax when I try to run this. if you can possibly
give
me a little more insight it would be greatly appreciated. Thank You!

Arvin Meyer said:
In the AfterUpdate event of the textbox which holds the parts used, do a
DCount of the part, and make sure the that the part exists in >=
quantity.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top