HOW CAN I VERIFY WHEN WITHDRAWING AN ITEM FROM A STORAGE IF IT EXISTS IN THE STORAGE?

C

Chris

I have a database for an existing stock in a warehouse. I made a table with
the entries in the storage, and a query with the total of materials which
are in the repository at a moment, for each name of the material, quality
dimension, measurement unit and price.
Now, I want to take some materials out of the storage. I want to a table
for them, but HOW CAN I VERIFY WHEN I ADD A MATERIAL IN THAT TABLE IF THIS
MATERIAL IS (EXISTS) IN THE STORAGE (if I have entries for it) and to GET AN
ERROR MESSAGE IF I DON'T HAVE IT IN THE STORAGE?

I would apreciate any help.
Thank you!
 
C

Chris

I am not sure I understand how to use the DLookup() function.
How can I use multiple criteria for the DLookup function in the validation
rule for a control on a form?(Ex:For every control except the first one,
the values for the precedent controls from the form are equal with the
fields having the same name in a query)
Can you PLEASE give me an example?
 
M

MacDermott

Gee, that sounds like a pretty different question to me -
Guess I don't have a very clear picture of what you're trying to do.
Let me mention a couple of things which may or may not be what you're
looking for:

1. You can put multiple criteria in a DLookup() by using AND, e.g.
DLookup("MyField","MyTable","Key1=2 AND Key2=25")

2. You can build a criteria string and use it in DLookup(), e.g.
Dim MyString as String
MyString="Key1=2"
MyString=MyString & " AND " & "Key2=25"
...DLookup("MyField","MyTable",MyString) 'Note no quotes around
variable name

3. Access doesn't very readily support an order of the controls on a form;
the MyForm.Controls collection is indexed only by the order in which
controls were put on the form, and this can't be changed. This may (or
more likely may not) be exactly the order you have in mind when you speak of
"previous controls".

4. What you ask is relatively complex. You should probably be looking at
running code in your control's Before Update event, rather than writing
validation rules.

5. It's generally unwise to base a validation rule on values in other
controls. A validation rule prevents you from leaving the current control;
if the problem is a value in a different control, you can't get to that
control to make the change - so you're pretty much stuck.

6. In a bound form, the value of a control is always equal to the value of
its controlsource, which is often the field having the same name in the
query.

Hope some of this helps...
- Turtle
 

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