Access 2003 --> Access 2007 code no longer working

  • Thread starter Thread starter Rebeca
  • Start date Start date
R

Rebeca

Hello,

I was recently upgraded to Access 2007 and code that worked in Access
2003 no longer works in 2007. The forms work link this. User enters
data into the main form. When information is entered into the Payment
field, another form popups up requesting more detail as to the payment
type. The 2nd form displays the data that was input in the original
form and when the user clicks accept, it checks to make sure that the
data on the 2nd form matches the first. If it does, the form closes
and returns to the original one. If it does not, a message box pops
up that says "Amounts do not match.Check your entries."

The problem is, in 2007, the amounts DO match, but the message box
keeps coming up and doesn't allow the user to continue. The code works
fine for those still using Access 2003.

Here is the piece of code that is affected. I'm assuming that it is
just a coding change from 2003 and 2007 as I ran into that with acEdit
as well.

' Display message if Total Amounts <> Payments
If Me!Payments <> Me!Total Then
strMsg = "Amounts do not match. Check your entries."
strTitle = "Amounts Do Not Match"
intStyle = vbOKOnly
MsgBox strMsg, intStyle, strTitle
Cancel = False

Any assistance or advice would be appreciated!
Thanks!
 
OMG. Proofreading would help. The second form displays the data that was input on the first form and the user then has to input the amount in either Cash/Check, Credit Card, Electronic, or Bad Debt Recovery. Then, when the user selects Accept Entries it checks to see that the amount entered in Payments and the amount entered in the other field matches. If it matches, it closes the form and returns to the first form. If it does not, they get the message box. Hope this makes it clearer.
 
Rebeca submitted this idea :
Hello,

I was recently upgraded to Access 2007 and code that worked in Access
2003 no longer works in 2007. The forms work link this. User enters
data into the main form. When information is entered into the Payment
field, another form popups up requesting more detail as to the payment
type. The 2nd form displays the data that was input in the original
form and when the user clicks accept, it checks to make sure that the
data on the 2nd form matches the first. If it does, the form closes
and returns to the original one. If it does not, a message box pops
up that says "Amounts do not match.Check your entries."

The problem is, in 2007, the amounts DO match, but the message box
keeps coming up and doesn't allow the user to continue. The code works
fine for those still using Access 2003.

Here is the piece of code that is affected. I'm assuming that it is
just a coding change from 2003 and 2007 as I ran into that with acEdit
as well.

' Display message if Total Amounts <> Payments
If Me!Payments <> Me!Total Then
strMsg = "Amounts do not match. Check your entries."
strTitle = "Amounts Do Not Match"
intStyle = vbOKOnly
MsgBox strMsg, intStyle, strTitle
Cancel = False

Any assistance or advice would be appreciated!
Thanks!

What have you try'd?

How about trying to include Me!Payments and Me!Total in the message
box. Are they identical??

Rdib
 
Rebeca submitted this idea :











What have you try'd?

How about trying to include  Me!Payments and Me!Total in the message
box.  Are they identical??

Rdib- Hide quoted text -

- Show quoted text -

Honestly, I haven't tried anything yet. The values are identical.
For example, if I put in $25 in the payments field on the first form,
a blank form pops up and shows the value from the first form in the
payments field on the second form. If I then put in $25 in the cash/
check field, and try to click accept it says the amounts don't match.
The value of the total field is Cash/Check+Credit Card+Electronic+Bad
Debt Received, in this case $25. There is no reason this shouldn't be
working since it works perfectly fine in Access 2003. That's what
leads me to think that there is changes to the code or formatting of
the code from 2003 to 2007 that I am not aware of.

I will try your suggestion.
Thanks.
 
Honestly, I haven't tried anything yet.  The values are identical.
For example, if I put in $25 in the payments field on the first form,
a blank form pops up and shows the value from the first form in  the
payments field on the second form. If I then put in $25 in the cash/
check field, and try to click accept it says the amounts don't match.
The value of the total field is Cash/Check+Credit Card+Electronic+Bad
Debt Received, in this case $25.  There is no reason this shouldn't be
working since it works perfectly fine in Access 2003.  That's what
leads me to think that there is changes to the code or formatting of
the code from 2003 to 2007 that I am not aware of.

I will try your suggestion.
Thanks.- Hide quoted text -

- Show quoted text -

OK. So in playing with this some more, here is what I have discovered
(and should have seen sooner). The total field is not calculating
unless you put the form in edit mode and then back in view mode. The
field was calculating through the control source on the form. I am
going to change this to VB calculation and see if that solves the
problem.
 
OK. So in playing with this some more, here is what I have discovered
(and should have seen sooner). The total field is not calculating
unless you put the form in edit mode and then back in view mode. The
field was calculating through the control source on the form. I am
going to change this to VB calculation and see if that solves the
problem.

The expression should work if you use Recalc or Requery on the Form in the
AfterUpdate event of the control that's being totalled.
--

John W. Vinson [MVP]
Microsoft's replacements for these newsgroups:
http://social.msdn.microsoft.com/Forums/en-US/accessdev/
http://social.answers.microsoft.com/Forums/en-US/addbuz/
and see also http://www.utteraccess.com
 
Back
Top