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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB Yes No 2

Status
Not open for further replies.

EasyOnly

Technical User
Oct 11, 2008
55
US
Hi All,

I am not sure What is missing in the below codes if I need the following. If someone choose Pending, the below happens. if someone choose anything else, nothing happens.If we change the status from pending to complete. the value in book does not change....Any help.....?



Private Sub_AfterUpdate()
If Me!Status = "Pending" Then
MsgBox("blah blah blah.........?", vbYesNo) = vbYes Then
Me.Book= "Yes"
Else
Me.Book= "No"
End If
End If

End Sub


Thanks
 
The code will only run if status = "Pending", because Me.Book= "No" is inside the message box If statement. Indenting code helps to show up this kind of thing.

Code:
Private Sub_AfterUpdate()
    If Me!Status = "Pending" Then
        MsgBox("blah blah blah.........?", vbYesNo) = vbYes Then
           Me.Book= "Yes"
        End If

        Me.Book= "No"
    End If   
End Sub

PS Please use the [ignore]
Code:
[/ignore] tags.

 
It is given me Compile error. syntex error. Something is missing....
 
Something is missing
Probably an If instruction ...
 
Code:
If Me!Status = "Pending" Then
    [COLOR=red][b]If[/b][/color] MsgBox("blah blah blah.........?", vbYesNo) = vbYes Then
        Me.Book= "Yes"
    Else
        Me.Book= "No"
    End If
End If


Randy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top