ChrisSedgwick
Registered User.
- Local time
- Today, 18:12
- Joined
- Jan 8, 2015
- Messages
- 119
Hi,
I'm trying to create and AfterUpdate event that will display a MsgBox if a Quantity entered into Box A, is greater than the Quantity shown in Box B.
I've managed to find a piece of code on this forum that sort of looked like it was what I needed. However, in my circumstances, it isn't just a flat form that I'm using the code in.
I have 1 form that contains 3 sub-forms within each other. I've called them
Main Form - FitterOrderAdd
1st Subform - TEST_Level2_Phase
2nd Subform - LEVEL_3_PRODUCT
3rd Subform - TEST_Level_4_Fitter
(Don't know why I named them this way. I think it was a rush job, so apologies).
The Text Box that we're entering the quantity in to is called "Actual Quantity" and is from the 3rd Subform. The Text Box that I want it to check against is called "Revised Quantity" and is from the 2nd Subform.
The code that I found is below. When I enter a quantity into "Actual Quantity" and tab along, I receive a Run-time error 2465 "Microsoft Access can't find the field "LEVEL_3_PRODUCT" referred to in your expression"
I'm presuming this is because I have different levels of subforms?
Could some offer a helping hand.
Man thanks,
Chris.
I'm trying to create and AfterUpdate event that will display a MsgBox if a Quantity entered into Box A, is greater than the Quantity shown in Box B.
I've managed to find a piece of code on this forum that sort of looked like it was what I needed. However, in my circumstances, it isn't just a flat form that I'm using the code in.
I have 1 form that contains 3 sub-forms within each other. I've called them
Main Form - FitterOrderAdd
1st Subform - TEST_Level2_Phase
2nd Subform - LEVEL_3_PRODUCT
3rd Subform - TEST_Level_4_Fitter
(Don't know why I named them this way. I think it was a rush job, so apologies).
The Text Box that we're entering the quantity in to is called "Actual Quantity" and is from the 3rd Subform. The Text Box that I want it to check against is called "Revised Quantity" and is from the 2nd Subform.
The code that I found is below. When I enter a quantity into "Actual Quantity" and tab along, I receive a Run-time error 2465 "Microsoft Access can't find the field "LEVEL_3_PRODUCT" referred to in your expression"
I'm presuming this is because I have different levels of subforms?
Code:
Private Sub Actual_Quantity_AfterUpdate()
If Me.Actual_Quantity > Form("LEVEL_3_PRODUCT")!["Revised Quantity"] Then
MsgBox "The quantity entered is greater than the Phase quantity.", vbInformation, "Phase Quantity"
Else
MsgBox "Quantity Accepted", vbInformation, "Phase Quantity"
End If
End Sub
Could some offer a helping hand.
Man thanks,
Chris.
Attachments
Last edited: