If Statement based on msgbox response

Kozbot

Registered User.
Local time
Today, 01:40
Joined
Jan 16, 2013
Messages
110
Hello

I have this code
Code:
Private Sub TestResult_BeforeUpdate(Cancel As Integer)
If Me.TestResult < DLookup("MinValue", "QCSpecs", "ProductCode='" & Forms!QC2EntryForm!ProductCode _
    & "' and TestName = '" & Forms!QC2EntryForm![QC2TestResults subform].Form.TestName & "'") Or Me.TestResult > _
    DLookup("MaxValue", "QCSpecs", "ProductCode='" & Forms!QC2EntryForm!ProductCode _
    & "' and TestName = '" & Forms!QC2EntryForm![QC2TestResults subform].Form.TestName & "'") Then
    MsgBox "The test result is out of spec. Press Yes to reject the sample or No to return to the form.", vbYesNo
End If
End Sub

What is the proper code to have a field's value determined by the Yes/No response?

I want a Yes/No field on the to be switched to "YES" if the user hits the Yes response on the msgbox.

Thank you!
 
Not quite sure what you are asking (looks like a word or two is missing) but I think the following is waht you are after

MyCtrl=MsgBox ("The test result is out of spec. Press Yes to reject the sample or No to return to the form.", vbYesNo)=vbYes
 
Not quite sure what you are asking (looks like a word or two is missing) but I think the following is waht you are after

MyCtrl=MsgBox ("The test result is out of spec. Press Yes to reject the sample or No to return to the form.", vbYesNo)=vbYes

When the user is prompted by the msgbox. I want a Yes/No type field on the form's value to be set to Yes if the user presses the "Yes" button on the msgbox.

How would I use an if statement to respond to the "yes" response from the msgbox?
 

Users who are viewing this thread

Back
Top Bottom