yes/no button confirmation

  • Thread starter Thread starter Edgar Chado via AccessMonster.com
  • Start date Start date
E

Edgar Chado via AccessMonster.com

I have found another way to do this which I fond more easy to use by the
users. I am using a search form which filters the records by date and
depending on the date it will let me edit the record or not.

By the way, I want to put a yes/no button which will let me display a
message box before puting its status to ok.

Up till now I have this code in the on click event,

Private Sub Anulado_Click()
Beep
If MsgBox("Est? seguro que quiere anular el pedido N?" & Me.N?_de_Pedido &
"?", vbQuestion + vbYesNo, "Anular el pedido?") = vbYes Then
End If
End Sub

What I am missing is the THEN section. I dont know what to put so it sets
the value of the yes/no option to yes if the users press enter on the
message box or leave it blank, I they cancel the action.
 
Assuming that Anulado is the name of a field with a Yes/No datatype:

If MsgBox..... Then Me.Anulado = True

This will set the field to Yes (True) if the user clicks Yes in the
message-box; it will be unchanged if the user clicks No or just closes the
message-box.

Note that for a one-line If... Then statement you can put this all on a
single line, and omit the End If

HTH,

Rob
 
Back
Top