Comparing the values in text fields in two different forms

S

SleepiJean

I am using Microsoft Access 2000 and I need to compare the value in a
revision level text field in my order details subform against the revision
level text field in the Parts form when the operator makes an entry in the
order details subform. This value could be either a number or a letter. If
the values are the same, the operator can continue entering the record. If
not, I want to display a message telling them that the values are not the
same and to inform the quality manager that there is a discrepancy and the
record can not be saved until the discrepancy is resolved. I wanted to put
the code for this in the AfterUpdate event for the revision level text field
in the order details subform. The Val function only works if the value is a
number and sometimes the revision level is a letter. Any help you can give
me would be appreciated.
 
S

SleepiJean

Thanks for the help. Here is what I did and it works.
If Me.Rev_Level = Forms.Parts.Rev_Level Then
Nextfield.setfocus
Else
Msgbox. "The revision level does not match............."
DoCmd.Close
End If

I had used Me.Rev_Level.Value before and it wouldn't work. I use Access a
lot but I usually keep it simple enough I don't need code. Again, Thanks for
the help.
 
R

ruralguy via AccessMonster.com

Glad I could help.
Thanks for the help. Here is what I did and it works.
If Me.Rev_Level = Forms.Parts.Rev_Level Then
Nextfield.setfocus
Else
Msgbox. "The revision level does not match............."
DoCmd.Close
End If

I had used Me.Rev_Level.Value before and it wouldn't work. I use Access a
lot but I usually keep it simple enough I don't need code. Again, Thanks for
the help.
Can't you just test for equality?
If Control1 <> Control2 then
[quoted text clipped - 18 lines]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top