Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

yes/no button behaviour

Status
Not open for further replies.

edgarchado

Technical User
Apr 5, 2005
59
AR
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.
 
the value of the yes/no option
Which option ? A checkbox ? An option group ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
PHV,

You are right, I forgot to clarify. It is a checkbox.

Thanks
 
Something like this ?
Me![checkbox control] = True

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Phv,

What if I would like to set the value of the yes/no option through an unbound command button.

The idea is for the user to click on a command button which will set the value yes in the table where is this yes/no field.

This command button will have assigned the code you helped me to fix. This way the user will need to confirm the action through a message box.

Thanks, and I hope I am clear enough.
 
PHV,

The problem is that I don´t know how to modify the part you posted before (Me![checkbox control] = True), so it works with the unbound command button.

If it helps, I can make it bound through a query. What would be easier?
 
edgarchado,

Put the code (without the parentheses) in the button's Click event.

Ken S.
 
How are ya edgarchado . . . . .

For the [purple]Command Button[/purple]:
Code:
[blue]Private Sub Anulado_Click()
   Dim Msg As String, Style As String, Title As String

   Msg = "Está seguro que quiere anular el pedido N°" & Me.N°_de_Pedido & "?"
   Style = vbQuestion + vbYesNo
   Title = "Anular el pedido?"
   Beep
   
   If MsgBox(Msg, Style, Title) = vbYes Then
      Me![checkbox control] = True
   Else
      Me![checkbox control] = False
   End If

End Sub[/blue]

Calvin.gif
See Ya! . . . . . .
 
AceMan,

It works just as I imaginied it should have. Thanks.

One question though. Is there a way to not use the "Me![checkbox control]" in the and reference it directly to the table?

For example (I know it is not correct) tblPedido.Anulado = True.

I don´t want to have the checkbox in the form, I want to have the event of the command button add the yes or no value to the field in the table
 
edgarchado,

If the form is bound to the table, all the fields in the table are exposed in the form's recordset, even if you haven't placed a corresponding field onto the form - so you don't actually have to put the field on your form in order to be able to refer to it with the Me![fieldname] syntax.

Ken S.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top