N
Nurse Nancy
Hi,
I have a Control button on a form that opens another form, I want to display
a message pop up on the new form if a calculated value on that form is
greater than 0, then the user can choose to close the new form or ignore the
warning.
If it's less than Zero, then i would disply a different pop up message.
I have 3 problems,, and if anyone can help with any one of them,, i would be
ever so greatful!
1. Where do i put the VB for the popup message,, so I can see the form open
and make a decision on whether to close it.
When i put it on the 2nd form property sheet,,,
On current - It displays after i hit the control-button, while I am still on
the first form so I can't see the new form open
On Focus - It displays while i am still on the first form so i can't see the
new form
On Click - Nothing happens, I don't get a message
I ended up putting it on the detail section of the new form and now whenever
I click on that, i get the message,, i only want it once after the form opens.
ANy suggestions?
2. I only want the pop up message to display if the value of a calculated
field is greater than zero and I want to display the value in the message.
The field is called Diff TB on the form and is calculated as
Sum([Prime Rate]*[Prime Spots]+[Rot Rate]*[Rot Spots]+[Other Rate]*[Other
Spots])
I don't know VB and when i tried to use the calc as is,, i get a syntax error
3. How do i code it so if it's greater than zero, i display a different
message?
Here's the code without the calc, which also doesn't work
Private Sub Detail_Click()
If [Diff TB] > 0 Then
Dim Msg, Style, Title, Help, Ctxt, Response, MyString
Msg = "Weekly Budget is Greater Than Total Perspective Buys, Do you want to
Add More Stations? Weekly Budget = $$$$$$, Diff = $$$$$$$"
Style = vbYesNo + vbDefaultButton2
Title = "MsgBox Demonstration"
Help = "DEMO.HLP"
Ctxt = 1000
End If
Response = MsgBox(Msg, Style, Title, Help, Ctxt)
If Response = vbYes Then ' User chose Yes.
MyString = "Yes"
DoCmd.RunCommand acCmdSaveRecord
DoCmd.close acForm, "Weekly Buy Table Form", acSaveYes
Else ' User chose No.
MyString = "No" ' Do Nothing
End If
End Sub
I have a Control button on a form that opens another form, I want to display
a message pop up on the new form if a calculated value on that form is
greater than 0, then the user can choose to close the new form or ignore the
warning.
If it's less than Zero, then i would disply a different pop up message.
I have 3 problems,, and if anyone can help with any one of them,, i would be
ever so greatful!
1. Where do i put the VB for the popup message,, so I can see the form open
and make a decision on whether to close it.
When i put it on the 2nd form property sheet,,,
On current - It displays after i hit the control-button, while I am still on
the first form so I can't see the new form open
On Focus - It displays while i am still on the first form so i can't see the
new form
On Click - Nothing happens, I don't get a message
I ended up putting it on the detail section of the new form and now whenever
I click on that, i get the message,, i only want it once after the form opens.
ANy suggestions?
2. I only want the pop up message to display if the value of a calculated
field is greater than zero and I want to display the value in the message.
The field is called Diff TB on the form and is calculated as
Sum([Prime Rate]*[Prime Spots]+[Rot Rate]*[Rot Spots]+[Other Rate]*[Other
Spots])
I don't know VB and when i tried to use the calc as is,, i get a syntax error
3. How do i code it so if it's greater than zero, i display a different
message?
Here's the code without the calc, which also doesn't work
Private Sub Detail_Click()
If [Diff TB] > 0 Then
Dim Msg, Style, Title, Help, Ctxt, Response, MyString
Msg = "Weekly Budget is Greater Than Total Perspective Buys, Do you want to
Add More Stations? Weekly Budget = $$$$$$, Diff = $$$$$$$"
Style = vbYesNo + vbDefaultButton2
Title = "MsgBox Demonstration"
Help = "DEMO.HLP"
Ctxt = 1000
End If
Response = MsgBox(Msg, Style, Title, Help, Ctxt)
If Response = vbYes Then ' User chose Yes.
MyString = "Yes"
DoCmd.RunCommand acCmdSaveRecord
DoCmd.close acForm, "Weekly Buy Table Form", acSaveYes
Else ' User chose No.
MyString = "No" ' Do Nothing
End If
End Sub