Yes or No key confirmation

G

Guest

Hello,
I have created Yes or No Key for confirmation of change of data with the
following codes. How can we make the default ( I mean active key is No),
because the tendency is just to hit the key, while actually no ( sorry I do
know how to say it in English, but maybe you already understood it)

Private Sub SuplierNo_BeforeUpdate(Cancel As Integer)
If Not IsNull(Me.[SuplierNo].OldValue) Then
If Me.[SuplierNo] <> Me.[SuplierNo].OldValue Then
If MsgBox("Anda telah merobah!!, apakah sengaja mau merobah?",
vbYesNo) = vbNo Then
' Undo the changes
SendKeys "{ESC}"
End If
End If
End If

End Sub

I appreciate any idea provided.

Frank
 
P

Pieter Wijnen

Add vbdefaultButton2 (and vbQuestion)
ie

vbYesNo + vbdefaultButton2 + vbQuestion

Pieter
 
G

Guest

Piet:

My expertise is Finance & Accounting, so I am not too good in writing VBA, I
am not so clear what you mean, could you please help me by inserting it on my
VBA codes for what you mean vbdefaultButton2 (and vbQuestion)

Thank you in advance

Frank

Pieter Wijnen said:
Add vbdefaultButton2 (and vbQuestion)
ie

vbYesNo + vbdefaultButton2 + vbQuestion

Pieter

Frank Situmorang said:
Hello,
I have created Yes or No Key for confirmation of change of data with the
following codes. How can we make the default ( I mean active key is No),
because the tendency is just to hit the key, while actually no ( sorry I
do
know how to say it in English, but maybe you already understood it)

Private Sub SuplierNo_BeforeUpdate(Cancel As Integer)
If Not IsNull(Me.[SuplierNo].OldValue) Then
If Me.[SuplierNo] <> Me.[SuplierNo].OldValue Then
If MsgBox("Anda telah merobah!!, apakah sengaja mau merobah?",
vbYesNo) = vbNo Then
' Undo the changes
SendKeys "{ESC}"
End If
End If
End If

End Sub

I appreciate any idea provided.

Frank
 
P

Pieter Wijnen

Instead of just vbYesNo.

MsgBox("Anda telah merobah!!, apakah sengaja mau merobah?", vbYesNo +
vbdefaultButton2 + vbQuestion) = vbNo Then


Pieter

Frank Situmorang said:
Piet:

My expertise is Finance & Accounting, so I am not too good in writing VBA,
I
am not so clear what you mean, could you please help me by inserting it on
my
VBA codes for what you mean vbdefaultButton2 (and vbQuestion)

Thank you in advance

Frank

Pieter Wijnen said:
Add vbdefaultButton2 (and vbQuestion)
ie

vbYesNo + vbdefaultButton2 + vbQuestion

Pieter

Frank Situmorang said:
Hello,
I have created Yes or No Key for confirmation of change of data with
the
following codes. How can we make the default ( I mean active key is
No),
because the tendency is just to hit the key, while actually no ( sorry
I
do
know how to say it in English, but maybe you already understood it)

Private Sub SuplierNo_BeforeUpdate(Cancel As Integer)
If Not IsNull(Me.[SuplierNo].OldValue) Then
If Me.[SuplierNo] <> Me.[SuplierNo].OldValue Then
If MsgBox("Anda telah merobah!!, apakah sengaja mau merobah?",
vbYesNo) = vbNo Then
' Undo the changes
SendKeys "{ESC}"
End If
End If
End If

End Sub

I appreciate any idea provided.

Frank
 
G

Guest

It just dont work Piet I do know what is wrong I just insert what you
suggested.

Thanks if you still have any idea.

Thanks

Frank

Pieter Wijnen said:
Instead of just vbYesNo.

MsgBox("Anda telah merobah!!, apakah sengaja mau merobah?", vbYesNo +
vbdefaultButton2 + vbQuestion) = vbNo Then


Pieter

Frank Situmorang said:
Piet:

My expertise is Finance & Accounting, so I am not too good in writing VBA,
I
am not so clear what you mean, could you please help me by inserting it on
my
VBA codes for what you mean vbdefaultButton2 (and vbQuestion)

Thank you in advance

Frank

Pieter Wijnen said:
Add vbdefaultButton2 (and vbQuestion)
ie

vbYesNo + vbdefaultButton2 + vbQuestion

Pieter

Hello,
I have created Yes or No Key for confirmation of change of data with
the
following codes. How can we make the default ( I mean active key is
No),
because the tendency is just to hit the key, while actually no ( sorry
I
do
know how to say it in English, but maybe you already understood it)

Private Sub SuplierNo_BeforeUpdate(Cancel As Integer)
If Not IsNull(Me.[SuplierNo].OldValue) Then
If Me.[SuplierNo] <> Me.[SuplierNo].OldValue Then
If MsgBox("Anda telah merobah!!, apakah sengaja mau merobah?",
vbYesNo) = vbNo Then
' Undo the changes
SendKeys "{ESC}"
End If
End If
End If

End Sub

I appreciate any idea provided.

Frank
 
G

Guest

Thank you very much Piet, after I tried again, It works now perfectly. You
are owesome.

Frank

Pieter Wijnen said:
Instead of just vbYesNo.

MsgBox("Anda telah merobah!!, apakah sengaja mau merobah?", vbYesNo +
vbdefaultButton2 + vbQuestion) = vbNo Then


Pieter

Frank Situmorang said:
Piet:

My expertise is Finance & Accounting, so I am not too good in writing VBA,
I
am not so clear what you mean, could you please help me by inserting it on
my
VBA codes for what you mean vbdefaultButton2 (and vbQuestion)

Thank you in advance

Frank

Pieter Wijnen said:
Add vbdefaultButton2 (and vbQuestion)
ie

vbYesNo + vbdefaultButton2 + vbQuestion

Pieter

Hello,
I have created Yes or No Key for confirmation of change of data with
the
following codes. How can we make the default ( I mean active key is
No),
because the tendency is just to hit the key, while actually no ( sorry
I
do
know how to say it in English, but maybe you already understood it)

Private Sub SuplierNo_BeforeUpdate(Cancel As Integer)
If Not IsNull(Me.[SuplierNo].OldValue) Then
If Me.[SuplierNo] <> Me.[SuplierNo].OldValue Then
If MsgBox("Anda telah merobah!!, apakah sengaja mau merobah?",
vbYesNo) = vbNo Then
' Undo the changes
SendKeys "{ESC}"
End If
End If
End If

End Sub

I appreciate any idea provided.

Frank
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top