VBA error on AfterUpdate expression

  • Thread starter Thread starter Steven Cheng
  • Start date Start date
S

Steven Cheng

I have written the following code for a textbox control:

Private Sub curFood_AfterUpdate()
allupdates1
allupdates2
End Sub

Private Sub allupdates1()
[curSubtotal].Value = [curFood].Value +
[curBeverage].Value + [curNewsPaper].Value +
[curParking].Value + [curSundry].Value
If bolChargeonGST = True Then
[curGST].Value = Round(([curSubtotal].Value +
[curGrats].Value) * 0.07, 2)
Else
[curGST].Value = Round([curSubtotal].Value *
0.07, 2)
End If
End Sub

Private Sub allupdates2()
[curPST_Retail].Value = Round(([curSundry].Value +
[curNewsPaper].Value) * 0.075, 2)
[curPST_Liquor].Value = Round([curBeverage].Value *
0.1, 2)
[curTotal].Value = [curSubtotal].Value +
[curGST].Value + [curPST_Retail].Value +
[curPST_Liquor].Value + [curGrats].Value
End Sub

All of the controls are bound to a table and have been
declared in the control source property. But the
following error message keeps poping up when I press
enter and/or change focus on this/these controls:

The expression After Update you entered as the evnt
property setting produced the following error: Procedure
declaration does not match description of event or
prcedure having the same name.
* the expression may not result in the name of the macro,
the name of a user-defined function or [Event Procedure],
* There may have been an error evaluating the function,
event, or macro.

I have tried changing the locking on the control and even
redoing the control. I have added the value property
just in case that this is the problem, but I don't think
it would matter as the default property for these
controls are value, right?

Can someone let me know.
 
I think that I have just resolved my problem. I have
placed Me! where appropriate and bang it works. Why is
it that I have to do this with these controls but in my
other Access dbase's I don't? I guess that this is
another question as well.
 
I am guessing that your controls and the fields they are bound to have the
same name. Access didn't know which one to use. Adding the Me! forced it to
use the controls.
 
You are absolutely correct. Thank you.
-----Original Message-----
I am guessing that your controls and the fields they are bound to have the
same name. Access didn't know which one to use. Adding the Me! forced it to
use the controls.

--
Wayne Morgan
Microsoft Access MVP


I have written the following code for a textbox control:

Private Sub curFood_AfterUpdate()
allupdates1
allupdates2
End Sub

Private Sub allupdates1()
[curSubtotal].Value = [curFood].Value +
[curBeverage].Value + [curNewsPaper].Value +
[curParking].Value + [curSundry].Value
If bolChargeonGST = True Then
[curGST].Value = Round(([curSubtotal].Value +
[curGrats].Value) * 0.07, 2)
Else
[curGST].Value = Round([curSubtotal].Value *
0.07, 2)
End If
End Sub

Private Sub allupdates2()
[curPST_Retail].Value = Round(([curSundry].Value +
[curNewsPaper].Value) * 0.075, 2)
[curPST_Liquor].Value = Round([curBeverage].Value *
0.1, 2)
[curTotal].Value = [curSubtotal].Value +
[curGST].Value + [curPST_Retail].Value +
[curPST_Liquor].Value + [curGrats].Value
End Sub

All of the controls are bound to a table and have been
declared in the control source property. But the
following error message keeps poping up when I press
enter and/or change focus on this/these controls:

The expression After Update you entered as the evnt
property setting produced the following error: Procedure
declaration does not match description of event or
prcedure having the same name.
* the expression may not result in the name of the macro,
the name of a user-defined function or [Event Procedure],
* There may have been an error evaluating the function,
event, or macro.

I have tried changing the locking on the control and even
redoing the control. I have added the value property
just in case that this is the problem, but I don't think
it would matter as the default property for these
controls are value, right?

Can someone let me know.


.
 
Back
Top