Negative Numbers

H

Harvey Maron

I have a inventory table with the following information in it.
InventoryID
ReceivingID
ShippingID
ProductID
LocationID
Qty on Hand

From a Receiving Form I update this table under Qty on hand I enter the qty
we receive.
From the shipping Form I update this table and under the Qty on Hand I enter
the qty shipped but I have to put a (-) sign in front so that when I to a
total in minuses the qty shipped.

Is there a way that from the Shipping Form I can just enter a Number and the
Form will automatically make it a Negative number

Regards
Harvey Maron
 
K

KARL DEWEY

In your Inventory_List query use a calculated field --
On_Hand: IIF([ShippingID] Is Null, [Qty on Hand], [Qty on Hand] * -1)
 
K

Ken Sheridan

In the AfterUpdate event procedure of the Qty on Hand control on your form put:

Dim ctrl as Control

Set ctrl = Me.ActiveControl

If ctrl > 0 Then
ctrl = ctrl * -1
End If

Ken Sheridan
Stafford, England
 
H

Harvey Maron

Ken
I have tried this and I keep getting a run-time error and I can not figure
out why
it states aas follows:
Run-time error'450':
Wrong number of arguments or invalid property assignment
When I debug it goes to the line
if ctrl >0 then

not sure what I have done wrong

regards
Harvey
 
K

Ken Sheridan

Harvey:

I can't see that you've done anything wrong if you've entered the code
exactly as in my original reply. The only situation in which I would foresee
it not working would be if a non-numeric value were entered in the control,
in which case you'd get a type mismatch error. Try using the actual control
name rather than referencing it:

If Me.[Qty on Hand] > 0 Then
Me.[Qty on Hand] = Me.[Qty On hand] * -1
End If

Ken Sheridan
Stafford, England
 
H

Harvey Maron

Ken
Thanks a lot that worked this time.

Regards
Harvey

Ken Sheridan said:
Harvey:

I can't see that you've done anything wrong if you've entered the code
exactly as in my original reply. The only situation in which I would foresee
it not working would be if a non-numeric value were entered in the control,
in which case you'd get a type mismatch error. Try using the actual control
name rather than referencing it:

If Me.[Qty on Hand] > 0 Then
Me.[Qty on Hand] = Me.[Qty On hand] * -1
End If

Ken Sheridan
Stafford, England

Harvey Maron said:
Ken
I have tried this and I keep getting a run-time error and I can not figure
out why
it states aas follows:
Run-time error'450':
Wrong number of arguments or invalid property assignment
When I debug it goes to the line
if ctrl >0 then

not sure what I have done wrong

regards
Harvey
 

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