Solved Match value in 2 fields IF statement (1 Viewer)

rondon

Member
Local time
Tomorrow, 00:57
Joined
May 16, 2020
Messages
53
I have a form created from a query Report Recommendations.
On the form there are two field one showing the total recommendations for a report the other identifies what recommendations you are reading. The number changes everytime the user clicks the next record button. I would like to write an IIF statement that compares the value in each field and when they are the same creates a message box (Last recommendation)
Feild1 = REC Total (which contains a static number)
Feild2 = REC Num (which updates the REC number as the user navigates through the recommendations by clicking on the cmb button)
e.g Total REC value 10 when the REC Num displays 10 message box appears
I have got so far but can’t seem to find the code for matching the values

Private Sub Command53_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Me.Rec Total = (?Matching Value Of?) Me.REC Num then
MsgBox MESSAGE_TEXT, vbExclamation, "Last recommendation"
Cancel = True
End If
End Sub
Any help would be good Thanks Ron
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 22:57
Joined
May 7, 2009
Messages
19,237
where is the code for Click event?
use that event so it will not advance to next record, eg:

If Me![Rec Total] = Me.CurrentRecord Then
MsgBox MESSAGE_TEXT, vbExclamation, "Last recommendation"
Else
'move to another record
End If
 

rondon

Member
Local time
Tomorrow, 00:57
Joined
May 16, 2020
Messages
53
If Me![Rec Total] = Me.CurrentRecord Then
MsgBox MESSAGE_TEXT, vbExclamation, "Last recommendation"
Else
'move to another record
End If
Thank you very much it worked
 

Users who are viewing this thread

Top Bottom