User Profile
Collapse
-
Thanks that works fine. :) Sorry it took me a while to reply. -
1. NumberInStock>= 0, guess I should put it back when the code works properly.
2. Thanks, that would solve the problem of the decrement effecting every item?
Yes that was the intention.
Removing the warning message would be best thanks.Leave a comment:
-
"You are about to update 36 rows. Once you click Yes, you can't use the undo command to reverse the changes. Are you sure you want to update these records?"
Click Yes- "Microsoft Access can't update all the records in the update query
Microsoft Access didn't update 0 fields(s) due to a type conversion failure, 0 record(s) due to key violations, 0 record(s) due to lock violations, and 57 record(s) due to validation...Leave a comment:
-
1/2
Sorry. Point 2. is correct it should have read "I've now altered it so that there are no spaces ('NumberOfItems ')."
A/B
No the #NAME? problem doesn't exist anymore, instead when you enter a number in the 'NumberOfItems' in tblOrderDetails Subform then click somewhere else a message comes up saying 'Runtime Error '3075' Syntax error missing operator in query expression NumberInStock+' and this code is highlighted-...Leave a comment:
-
Thanks I hadn't realised that. I've now altered it so that there are no spaces ('NumberInStock '). I tested this and when you enter a number in the 'NumberOfItems' in tblOrderDetails Subform then click somewhere else a message comes up saying 'Runtime Error '3075' Syntax error missing operator in query expression NumberInStock+'...Leave a comment:
-
2. Subform-Mainform-Code:SELECT tblOrderDetail.OrderID, tblOrderDetail.ItemID, tblOrderDetail.Timing, tblOrderDetail.[Number of Items], tblItem.Cost, tblItem.Notes FROM tblItem INNER JOIN tblOrderDetail ON tblItem.ItemID=tblOrderDetail.ItemID;3.Code:tblOrder
...Code:NumberofItems
Leave a comment:
-
1. Yes it does, it's there all the time.
2. the forms are structured as follows- tblOrder (OrderID, TableID, GuestsArrived, GuestsLeft, DateOfOrder, TimeOfOrder, Notes)
tblOrderDetails Subform (OrderID, ItemID, Timing, NumberOfItems)
tblOrder is the main form and tblOrderDetails Subform is the subform.
Both forms come from tables of the same name- tblOrder and tblOrderDetails
3. The control source...Leave a comment:
-
Yes it was #NAME? sorry. It appears in the NumberOfItems field on the OrderDetails Subform- where the data would be entered.
Regarding
I've tried the new code and #NAME? still apears in the same place. This means I can't enter data, it that what you mean?
CtrlG produced the window with code in, no message appears, if you press Run then a window appears asking for Maco Name does come up thoug...Leave a comment:
-
Thanks. I tried the code you gave exactly and nothing happened- no error message, no deduction in stock shown in tblItem.
I tried changing the code to
...Code:Private Sub NumberofItems_BeforeUpdate(Cancel As Integer) DoCmd.RunSQL "UPDATE tblItem " & _ "SET NumberInStock = NumberInStock+" & _ Me.NumberofItems.OldValue - Me.NumberofItems EndLeave a comment:
-
-
I'm not sure I understand. The 'NumberOfItems' (frmOrderDetail s Subform) where the number is being entered, and what the event will be triggered by, is not the new total for the 'NumberInStock' (tblItems), it is the number of meals that have been used up, so the NumberInStock needs to be the same as before less the number that have been used. Sorry if I've got this confused....Leave a comment:
-
A. Taking Rabbit's point into consideration I would like to use an After Update on the 'Number of Items' field in the 'OrderDetails Subform', of the 'Order' form
B. Nothing extra needs to be shown on the 'Order' form or the 'OrderDetails Subform'. With the use of code, the number of a particular item orderd (e.g. 2 Risottos) will be entered in the 'OrderDetails Subform', in a field called 'Number of Items', and then that number will...Leave a comment:
-
I don't understand, what other information should I provide in addition to post #12?Leave a comment:
-
No one has come back to me in in the past week. If I'm asking the wrong kind of question could someone tell me?...Leave a comment:
-
To attach the event to a button woulld be best, if the process happens automatically then I would encounter problems if the order changed after being made. The idea is that when an order is made 2 steak and chips and 1 risotto are entered on the order form (made up of frmOrder and frmOrderDetails Subform, the data entry is on the subform). 2 then needs to be deducted from the number of steak and chips in stock, and 1 from the number of risottos,...Leave a comment:
-
-
Can anyone else help?
I have tried creating a button in the subform that would appear after every meal but it isn't showing up on the form. So instead I tried attaching the code below onto a button on the main form-
But an error message- 'Can't find the macro...' appearsCode:tblItem!NumberInStock=tblItem!NumberInStock- me![tblOrderDetail Subform]![Number of Items]
Can anyone else help? I think...Leave a comment:
-
( tblOrder
OrderID (key)
TableID (foreign key)
GuestsArrived
GuestsLeft
Order Notes )
tblOrderDetail
OrderID (key)
ItemID (key)
Number of Items
Item Notes
tblItem
ItemID (key)
Name
ItemTypeID (foreign key)
NumberInStock
Re-OrderLevel
Cost
Notes
InUse
Yes ItemID is the Key. I don't...Leave a comment:
-
'Number of Items' is stored in 'tblOrderDetail s' 'Number of (Items) in Stock' is stored in 'tblItems'. Using 'frmOrderDetail s' I want to input the 'Number of Items' and that number to be subtracted from 'Number of (Items) in Stock' .
I'm using the word Items instead of Meals, because it also includes drinks.
I dont know whether I've made it clear but this is for a particular meal- not a total of all meals in the...Leave a comment:
-
deducting a number in a field on a form from a table
I am creating a restaurant meal ordering system. I am not very good with VB code, but am getting the hang of it slowly. I want to be able to enter the number of meals requested as part of an order onto frmOrderDetails ( the subform of frmOrder ) and that number to be deducted from the number of that meal in stock in the tblMeal, and am not sure how to go about it?
No activity results to display
Show More
Leave a comment: