VBA for message box

hfsitumo2001

Member
Local time
Today, 15:02
Joined
Jan 17, 2021
Messages
394
In my form view or change the items, there is a discontinue box. Can anyone give me what is the VBA on Current of the form, then if the discontinue box is True, (Ticked in the box), there is a pop up a message box to say "Please do not use the item, it was discontuned" then we press "OK" to close the message box.

Thank you
 
Did you try to put together some code? it can be 3 lines of code in the proper way. the not proper way is one line of code.
People try to help and create a solution when others get stuck. The best way to learn is try, make mistakes and retry.
 
Did you try to put together some code? it can be 3 lines of code in the proper way. the not proper way is one line of code.
People try to help and create a solution when others get stuck. The best way to learn is try, make mistakes and retry.
OK Rene I will try it
 
I was going to post a link to that infamous "what have you tried" article by matt gremell, but he has gotten woke and now claims he regrets it, it was too mean. which just makes the article double-infamous, incidentally
 
In my form view or change the items, there is a discontinue box. Can anyone give me what is the VBA on Current of the form, then if the discontinue box is True, (Ticked in the box), there is a pop up a message box to say "Please do not use the item, it was discontuned" then we press "OK" to close the message box.

Thank you
And what do you do, when I decide to ignore that message? :)
 
Code:
Private Sub Form_Current()
  if me.DiscontinuedFieldName then
  Msgbox "Please do not use item, it was discontinued"
end if
End Sub

I am guessing you may want to do more than a message like disable controls or the whole record when true.

Maybe
Code:
Private Sub Form_Current()
  if me.DiscontinuedFieldName then
  Msgbox "Please do not use item, it was discontinued"
  me.allowedits = false
end if
End Sub
 
I was thinking more of not presenting any item that has been marked as discontinued?
 
Code:
Private Sub Form_Current()
  if me.DiscontinuedFieldName then
  Msgbox "Please do not use item, it was discontinued"
end if
End Sub

I am guessing you may want to do more than a message like disable controls or the whole record when true.

Maybe
Code:
Private Sub Form_Current()
  if me.DiscontinuedFieldName then
  Msgbox "Please do not use item, it was discontinued"
  me.allowedits = false
end if
End Sub
Thank you MajP, the code that I made is with True, I think you know that, but you want me to understand what I am doing, Thank you

Private Sub Form_Current()
If Me.Discontinued = True Then
MsgBox "Please do not use the item, it was discontinued"
Me.AllowEdits = False
End If
End Sub
 
I tried to make a message box, I want it when I open it and it shows up the message not before open. I shows up before we open. now I tried on mouse move, but it did not work either.
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
MsgBox "Make sure that the UOM is in Case and the price is price of a Case"
End Sub
 

Users who are viewing this thread

Back
Top Bottom