VBA for message box (1 Viewer)

hfsitumo2001

Member
Local time
Yesterday, 22:45
Joined
Jan 17, 2021
Messages
365
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
 

Rene vK

Member
Local time
Today, 07:45
Joined
Mar 3, 2013
Messages
123
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.
 

hfsitumo2001

Member
Local time
Yesterday, 22:45
Joined
Jan 17, 2021
Messages
365
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
 

Isaac

Lifelong Learner
Local time
Yesterday, 22:45
Joined
Mar 14, 2017
Messages
8,777
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
 

Gasman

Enthusiastic Amateur
Local time
Today, 06:45
Joined
Sep 21, 2011
Messages
14,310
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? :)
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 01:45
Joined
May 21, 2018
Messages
8,529
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
 

Gasman

Enthusiastic Amateur
Local time
Today, 06:45
Joined
Sep 21, 2011
Messages
14,310
I was thinking more of not presenting any item that has been marked as discontinued?
 

hfsitumo2001

Member
Local time
Yesterday, 22:45
Joined
Jan 17, 2021
Messages
365
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
 

hfsitumo2001

Member
Local time
Yesterday, 22:45
Joined
Jan 17, 2021
Messages
365
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

Top Bottom