Can you explain why would I use the form's BeforeUpdate event instead of
the
field's beforeupdate event? I have 8 of these controls that must be
checked
for null first.
I am getting the following error message:
You must save the field before you execute the GoToControl action, the
GoToControl method, or the SetFocus method.
You tried to move the focus to another control using the SetFocus method,
GoToControl action, or the GoTo Control method.
Set the macro or method to the AfterUpdate property instead of the
BeforeUpdate property so it saves the field before changing the focus.
Ken Snell said:
I've not used the function that you're using, but it's possible that a
Null
value could cause a problem.
Use the form's BeforeUpdate event to test if the value in the
txtNumMonths
control is empty, and require the user to enter a value; you'd do that by
canceling the event and putting focus on that textbox with a popup
message
to inform the user.
--
Ken Snell
<MS ACCESS MVP>
Thanks Ken!
That makes sense. I can do that.
Upon further testing, trying to make it error out, I also determined
that
sometimes the [txtNumMonths1] has not been filled in. That would make
the
value null, correct? And cause the calculation to error out. Would this
be
an
additional cause?
Besides resetting the tab order, what would be the best way to force
the
user fill in the number of months before they get to the rate box?
:
When you read a value from a column of a combo box, that value usually
is
a
string, regardless of what you have set for it in the Row Source query
for
the combo box. I'm guessing that you need to cast the combo box's
column
1
value as a number:
arguments = [txtMoPIpmt1],
Pmt((CDbl([cboL1Rate].[Column](1))*0.01)/12,[Forms]![frmBuildFlyer]![txtNumMonths1],[txtLA1]*-1)
--
Ken Snell
<MS ACCESS MVP>
I have a mortgage application that has been working fine for 2 weeks,
but
now
is coming up with "type mismatch error" when I try to change the
rate
in a
combo box.
This combo box is based on a table and the data is numerical. It has
event
that goes to a macro.
mcoPmt
condition = True: [cboL1Rate] Is Not Null And [optIOonly1a]=False
action = SetValue
arguments = [txtMoPIpmt1],
Pmt(([cboL1Rate].[Column](1)*0.01)/12,[Forms]![frmBuildFlyer]![txtNumMonths1],[txtLA1]*-1)
Could someone look at this and perhaps see something that I'm not
seeing?
And why would it work for weeks, then not work?