yes/no field - after update query

S

Sangeetha

please help me,

I have this coding in a yes/no files named paid.

I want to get confirmation from use, before he updates this field. The macro
is not trigerred when, I make changes to the field.There is somethign wrong
with the coding. please help.

Private Sub PAID_AfterUpdate()
Dim msg1 As String
If PAID.Value = 1 Then
msg1 = MsgBox("Are you sure, the client has paid", vbOKCancel)
If msg1 = 1 Then
Dim Msg3 As String
Msg3 = MsgBox("Please proceed", vbOKOnly)
Elsif
Undo
Else
Dim msg2 As String
msg2 = MsgBox("Ask the client to pay!Thanks", vbOKOnly)
End If
 
R

Ron2006

If "Paid" is a yes/no field then you have the test wrong.

you can say

if me.paid ' this is because it is a true false field
and will say that

OR

if me.paid = true

OR

if me.paid = -1 ' The true value is stored as -1 (a
minus one)

Ron
 
S

Sangeetha

I changes it, Even this one is not working. Please help

Private Sub PAID_AfterUpdate()
Dim msg1 As String
If Me.PAID = -1 Then
msg1 = MsgBox("Are you sure, the client has paid", vbOKCancel)
If msg1 = 1 Then
Dim msg2 As String
msg2 = MsgBox("please proceed", vbOKOnly)
Else
Dim msg3 As String
msg3 = MsgBox("please ask the client to pay", vboknly)
Undo
Elsif
Undo
End If
End Sub
 
D

Douglas J. Steele

When you look at the Properties window for the checkbox, does it say [Event
Procedure] as the value for the AfterUpdate property? If so, when you click
on the ellipsis (...) to the right of the property, are you taken into the
correct code?

Incidentally, the MsgBox function returns an Integer, not a String.

The three declarations

Dim msg1 As String
Dim msg2 As String
Dim msg3 As String

should be

Dim msg1 As Integer
Dim msg2 As Integer
Dim msg3 As Integer
 
S

Sangeetha

Hi,

I tried this. Even it is not working. it does not trigger at all. Please help.

Private Sub PAID_AfterUpdate()
Dim msg1 As Integer
If Me.PAID = -1 Then
msg1 = MsgBox("Are you sure, the client has paid", vbOKCancel)
If msg1 = 1 Then
Dim msg2 As Integer
msg2 = MsgBox("please proceed", vbOKOnly)
Else
Dim msg3 As Integer
msg3 = MsgBox("please ask the client to pay", vboknly)
Undo
Elsif
Undo
End If
End Sub

Thanks
Sangeetha
 

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