vbOkCancel problem

Rockape

Registered User.
Local time
Today, 12:14
Joined
Aug 24, 2007
Messages
271
Hi all,

(I am using A03)

I've looked into this issue using the search facility but I havent managed to find suitable assistance. I am checking the options in an option group.

I am hoping that the user is made aware that the options have not been toggled. Given the option using vbOKCancel, the user can either return to the record to amend (ie toggle the option) or allowed to continue (without having any option toggled) by pressing OK.

This is the code I am using but it is not working.......

Grateful for assistance...........

Private Sub Command43_Click()

Dim response As Variant

response = MsgBox("Please note you have not chosen an option", vbOKCancel)

If IsNull(Me.optionframe) Then response
End If

If response = vbCancel Then
Exit Sub

Else

DoCmd.GoToRecord , , acNewRec

End If

End Sub
 
Last edited:
You need to say more than "it is not working." What is not working about it?
 
How about:

Dim response As Variant

Code:
If IsNull(Me.optionFrame) Then
    response = MsgBox("Please note you have not chosen an option", vbOKCancel)

    If response = vbCancel Then
        Exit Sub
    End If
End If

DoCmd.GoToRecord , , acNewRec

Also, put yourself in the position of the user when they get the message "Please note you have not chosen an option". There is no clue to the user what will happen if they click Ok compared to Cancel i.e. it's not intuitive that ok means carry on to the next step and cancel means go back. Cancel could mean just cancel (ignore) the warning. I'd add some more text to say what each button will do.

hth
Chris
 
Hi,

My apologies .....I should be more careful with my explanations... Anyway your code works or rather performs the action that I want.

By pressing Ok, the user has decided that he/she has read the message(message will be become more explicit, thanks for the advice) and is happy to continue without toggling any of the options.

Cancel on the other hand returns the user to the current record and toggles the option that he/she forgot to toggle.

Many thanks yet again.






How about:

Dim response As Variant

Code:
If IsNull(Me.optionFrame) Then
    response = MsgBox("Please note you have not chosen an option", vbOKCancel)
 
    If response = vbCancel Then
        Exit Sub
    End If
End If
 
DoCmd.GoToRecord , , acNewRec

Also, put yourself in the position of the user when they get the message "Please note you have not chosen an option". There is no clue to the user what will happen if they click Ok compared to Cancel i.e. it's not intuitive that ok means carry on to the next step and cancel means go back. Cancel could mean just cancel (ignore) the warning. I'd add some more text to say what each button will do.

hth
Chris
 
My apologies... I meant that it was not functioning the way I wanted it to. I agree I should have been more specific.

I tend to commit these stupid errors :confused:. I will try to be more specific next time.



You need to say more than "it is not working." What is not working about it?
 
Last edited:

Users who are viewing this thread

Back
Top Bottom