Stop a message repeating

  • Thread starter Thread starter Colin G eastwood
  • Start date Start date
C

Colin G eastwood

Hi there

I have a report which analyses telephone-call costs; if a call is found
with a duration of over 4hrs, a MsgBox statement to that effect is
displayed.
When this message has been displayed once, I do not wish it to appear
again, however the exact mechanics of how to do this are eluding me.

Is anyone able to help?
Kind regards
Colin G Eastwood
--
 
The "exact mechanics of how" you are displaying "a MsgBox statement"
"eludes" us. How can we suggest how not to show something if we don't know
how it is being shown/triggered?
 
Duane Hookom said:
The "exact mechanics of how" you are displaying "a MsgBox statement"
"eludes" us. How can we suggest how not to show something if we don't know
how it is being shown/triggered?

Hi Duane

Quite right!

I will try to be a bit more descriptive.

The following code has been created as the [Event Procedure] in the
'Detail' section of my report:

"Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
On Error GoTo My_Error_Check

If Val(Left(Me.CallDuration, 1)) > 0 Then
'Turns text red for calls over an hour long.
Me.Date.ForeColor = 255
Me.Time.ForeColor = 255
Me.CalledNo.ForeColor = 255
Me.Destination.ForeColor = 255
Me.CallDuration.ForeColor = 255
Me.Cost.ForeColor = 255
Me.CostPerMin.ForeColor = 255
If Val(Left(Me.CallDuration, 1)) > 4 Then
'Also shows a message if there are calls over 4 hours
long
MsgBox "You have a call listed at over 4 hours duration.",
vbInformation, "Data warning"
End If
Else
'Normal text colours are used.
Me.Date.ForeColor = 0
Me.Time.ForeColor = 0"
etc. etc.

The second 'IF' in the above statement is what I require the help for,
as on EVERY occurrence of ">4" the message appears, you will remember I
wish it to appear one time only.
Kind regards
Colin G Eastwood
--
 
You can create a public memory variable in your report modules declarations
section:
Dim booDoneMsged as Boolean

Then in the code, use:
If Val(Left(Me.CallDuration, 1)) > 4 And booDoneMsged = False Then
MsgBox "You have a call listed at over 4 hours duration.", _
vbInformation, "Data warning"
booDoneMsged = True
End If

--
Duane Hookom
MS Access MVP


Colin G eastwood said:
Duane Hookom said:
The "exact mechanics of how" you are displaying "a MsgBox statement"
"eludes" us. How can we suggest how not to show something if we don't know
how it is being shown/triggered?

Hi Duane

Quite right!

I will try to be a bit more descriptive.

The following code has been created as the [Event Procedure] in the
'Detail' section of my report:

"Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
On Error GoTo My_Error_Check

If Val(Left(Me.CallDuration, 1)) > 0 Then
'Turns text red for calls over an hour long.
Me.Date.ForeColor = 255
Me.Time.ForeColor = 255
Me.CalledNo.ForeColor = 255
Me.Destination.ForeColor = 255
Me.CallDuration.ForeColor = 255
Me.Cost.ForeColor = 255
Me.CostPerMin.ForeColor = 255
If Val(Left(Me.CallDuration, 1)) > 4 Then
'Also shows a message if there are calls over 4 hours
long
MsgBox "You have a call listed at over 4 hours duration.",
vbInformation, "Data warning"
End If
Else
'Normal text colours are used.
Me.Date.ForeColor = 0
Me.Time.ForeColor = 0"
etc. etc.

The second 'IF' in the above statement is what I require the help for,
as on EVERY occurrence of ">4" the message appears, you will remember I
wish it to appear one time only.
Kind regards
Colin G Eastwood
--
 
Duane Hookom said:
You can create a public memory variable in your report modules declarations
section:
Dim booDoneMsged as Boolean

Then in the code, use:
If Val(Left(Me.CallDuration, 1)) > 4 And booDoneMsged = False Then
MsgBox "You have a call listed at over 4 hours duration.", _
vbInformation, "Data warning"
booDoneMsged = True
End If
Hi Duane

I really felt confident using your code (as suggested above) . . .
when it didn't work I remembered I had tried a Dim statement to store
this data in a similar kind of setup before.

The message (I'm afraid) still appears at each instance of a >4hr call
duration.

Any other ideas?
Kind regards
Colin G Eastwood
--
 
Duane Hookom said:
You can create a public memory variable in your report modules declarations
section:
Dim booDoneMsged as Boolean

Hi Duane

Forget the last post.

I see now, its WHERE you declare the variable that's the key.

B.F. Marvellous
many thanks Colin

Kind regards
Colin G Eastwood
--
 
Back
Top