ALERT Message ?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am using a time and attendence form which has two sub forms. The main form
has a field which contains an employee's scheduled hours. sub form #1
contains the employee's actual hours worked for the current pay period and
also has a sum of the total hours worked. I would like to create some kind of
alert informing the data enterer that the two fields are unequal if in fact,
that is the case. I do not want this message to unallow the data enterer to
move on to the next employee. I just want him / her to be aware. (Access 2002)

Any help would be greatly appreciated.

Thanks in advance.

John
 
To what extent do you not want them to be able to move on? A message box
could do this, but they would have to click Ok before they could move on.
They would be able to move on, they would have to just click Ok (or hit
Enter) first. Another option that would be less intrusive would be
Conditional Formatting. You could change the color of the text in the
textbox or perhaps in a banner across the top of the form to indicate that
there is a discrepancy.

Message Box Example:
If Me.txtTotalHours <> Me.NameOfSubformControl.Form.txtTotalHours Then
Msgbox "The hours worked and hours scheduled don't match.", vbOkOnly +
vbInformation, "Check Hours"
End If

For the Conditional formatting, in design view right click the control you
want to change and choose Conditional Formatting. Set the combo box in the
dialog to Expression and set the expression to

txtTotalHours <> NameOfSubformControl.Form.txtTotalHours

set the options (color, etc) as desired.
 
Have a look at my post messagebox code earlier I'm doing the same thing
Tony Williams
 
John I ended up using this
Private Sub txtDomfactot_BeforeUpdate(Cancel As Integer)
If ([txtDomfacsole] + [txtDomfacpart]) <> [txtDomfactot] Then
If MsgBox("Row 1 does not add up" & vbCrLf & "It should be " &
[txtDomfacsole] + [txtDomfacpart] & " - Do you want to accept the error?",
vbYesNo, "Calculation Error") = vbNo Then Cancel = True
End If
End Sub

hope that helps
Tony Williams
 
Back
Top