Docmd.Setwarning False Not Working

S

SN

Good Morning
I was hoping someone could possibly assist.

My my after update event, my Docmd. Setwarning False, still tells me i have
deleted a record after i have set it to False.

I have turned them on and off after and before every command, but it still
happens

I was told to change the code from docmd.runsql to CurrentDb.Execute and
still it happens.

Code:
Private Sub OffLettReceived_AfterUpdate()
On Error GoTo Err_Handler

Dim stDocName As String
Dim stLinkCriteria As String
Dim iAnswer As Integer

If IsNull(Me!ID) Then stLinkCriteria = ""
stLinkCriteria = "[ID]=" & Me![ID]


If Me.OffLettReceived = -1 Then

DoCmd.SetWarnings (False)

iAnswer = MsgBox("Would like to move the record for " _
& Me.FirstName & " " & Me.Surname & " " _
& "to the Employee Table?" _
, vbCrLf & vbYesNoCancel)


DoCmd.SetWarnings (True)

If iAnswer = vbYes Then

DoCmd.SetWarnings (False)

Me.Status = "offer"

CurrentDb.Execute "INSERT INTO tblEmpInfo SELECT * FROM TblOffer " & _
" WHERE [ID] = " & Forms!frmOffer!ID, dbFailOnError

CurrentDb.Execute "DELETE * FROM TblOffer " & _
" Where [ID] = " & Forms!frmOffer!ID, dbFailOnError


Me!CurrOffer.Requery

DoCmd.SetWarnings (True)

Else

DoCmd.Beep

End If

Forms!frmOffer.Requery

DoCmd.SetWarnings True

Exit_Status_Change:
Exit Sub

Err_Handler:
MsgBox Err.Description
Resume Exit_Status_Change

End If
End Sub



I was hoping someone could possible assit where i might be going wrong,
 
L

Linq Adams via AccessMonster.com

Actually, Ture/False is an arguement so it's

Docmd.SetWarnings False
 
D

Douglas J. Steele

Shouldn't that be

If IsNull(Me!ID) Then
stLinkCriteria = ""
Else
stLinkCriteria = "[ID]=" & Me![ID]
End If

Afraid, though, that I can't see why you'd get a notification. You shouldn't
be getting any notifications using the Execute method: that's one of its
advantages. The SetWarnings should be unnecessary.
 
S

SN

I have tried several different option, and unfortunately no luck, I have
spent quite a bit of time trying to solve it, and been thinking of maybe just
trying to work around it,.

Is there maybe a way, instead of a "record is deleted notifcation! that i
can change the message, to say something like "The record for Mr ABC has been
moved"
So changing the default notification...

thanks in advance


Douglas J. Steele said:
Shouldn't that be

If IsNull(Me!ID) Then
stLinkCriteria = ""
Else
stLinkCriteria = "[ID]=" & Me![ID]
End If

Afraid, though, that I can't see why you'd get a notification. You shouldn't
be getting any notifications using the Execute method: that's one of its
advantages. The SetWarnings should be unnecessary.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


SN said:
Good Morning
I was hoping someone could possibly assist.

My my after update event, my Docmd. Setwarning False, still tells me i
have
deleted a record after i have set it to False.

I have turned them on and off after and before every command, but it still
happens

I was told to change the code from docmd.runsql to CurrentDb.Execute and
still it happens.

Code:
Private Sub OffLettReceived_AfterUpdate()
On Error GoTo Err_Handler

Dim stDocName As String
Dim stLinkCriteria As String
Dim iAnswer As Integer

If IsNull(Me!ID) Then stLinkCriteria = ""
stLinkCriteria = "[ID]=" & Me![ID]


If Me.OffLettReceived = -1 Then

DoCmd.SetWarnings (False)

iAnswer = MsgBox("Would like to move the record for " _
& Me.FirstName & " " & Me.Surname & " " _
& "to the Employee Table?" _
, vbCrLf & vbYesNoCancel)


DoCmd.SetWarnings (True)

If iAnswer = vbYes Then

DoCmd.SetWarnings (False)

Me.Status = "offer"

CurrentDb.Execute "INSERT INTO tblEmpInfo SELECT * FROM TblOffer " & _
" WHERE [ID] = " & Forms!frmOffer!ID, dbFailOnError

CurrentDb.Execute "DELETE * FROM TblOffer " & _
" Where [ID] = " & Forms!frmOffer!ID, dbFailOnError


Me!CurrOffer.Requery

DoCmd.SetWarnings (True)

Else

DoCmd.Beep

End If

Forms!frmOffer.Requery

DoCmd.SetWarnings True

Exit_Status_Change:
Exit Sub

Err_Handler:
MsgBox Err.Description
Resume Exit_Status_Change

End If
End Sub



I was hoping someone could possible assit where i might be going wrong,
 
D

Douglas J. Steele

There's no way to change the default messages that I'm aware of. Since
they're not error messages, I don't think there's any way to intercept them.

I still can't understand why you'd be getting them when you're using the
Execute method. Are you sure the messages aren't coming from somewhere else
in your code?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


SN said:
I have tried several different option, and unfortunately no luck, I have
spent quite a bit of time trying to solve it, and been thinking of maybe
just
trying to work around it,.

Is there maybe a way, instead of a "record is deleted notifcation! that i
can change the message, to say something like "The record for Mr ABC has
been
moved"
So changing the default notification...

thanks in advance


Douglas J. Steele said:
Shouldn't that be

If IsNull(Me!ID) Then
stLinkCriteria = ""
Else
stLinkCriteria = "[ID]=" & Me![ID]
End If

Afraid, though, that I can't see why you'd get a notification. You
shouldn't
be getting any notifications using the Execute method: that's one of its
advantages. The SetWarnings should be unnecessary.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


SN said:
Good Morning
I was hoping someone could possibly assist.

My my after update event, my Docmd. Setwarning False, still tells me i
have
deleted a record after i have set it to False.

I have turned them on and off after and before every command, but it
still
happens

I was told to change the code from docmd.runsql to CurrentDb.Execute
and
still it happens.

Code:
Private Sub OffLettReceived_AfterUpdate()
On Error GoTo Err_Handler

Dim stDocName As String
Dim stLinkCriteria As String
Dim iAnswer As Integer

If IsNull(Me!ID) Then stLinkCriteria = ""
stLinkCriteria = "[ID]=" & Me![ID]


If Me.OffLettReceived = -1 Then

DoCmd.SetWarnings (False)

iAnswer = MsgBox("Would like to move the record for " _
& Me.FirstName & " " & Me.Surname & " " _
& "to the Employee Table?" _
, vbCrLf & vbYesNoCancel)


DoCmd.SetWarnings (True)

If iAnswer = vbYes Then

DoCmd.SetWarnings (False)

Me.Status = "offer"

CurrentDb.Execute "INSERT INTO tblEmpInfo SELECT * FROM TblOffer " &
_
" WHERE [ID] = " & Forms!frmOffer!ID, dbFailOnError

CurrentDb.Execute "DELETE * FROM TblOffer " & _
" Where [ID] = " & Forms!frmOffer!ID, dbFailOnError


Me!CurrOffer.Requery

DoCmd.SetWarnings (True)

Else

DoCmd.Beep

End If

Forms!frmOffer.Requery

DoCmd.SetWarnings True

Exit_Status_Change:
Exit Sub

Err_Handler:
MsgBox Err.Description
Resume Exit_Status_Change

End If
End Sub



I was hoping someone could possible assit where i might be going wrong,
 
S

SN

AAA thank you for the response and sorry for the delay

Dough I got it fixed

I had a few DoMenuItems in the rest of the code..

I changed it all to
docmd.runcommand accmd..

and it worked,

brilliant,

thank you very much thought for all the assistance

Kind Regards
Susan

Douglas J. Steele said:
There's no way to change the default messages that I'm aware of. Since
they're not error messages, I don't think there's any way to intercept them.

I still can't understand why you'd be getting them when you're using the
Execute method. Are you sure the messages aren't coming from somewhere else
in your code?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


SN said:
I have tried several different option, and unfortunately no luck, I have
spent quite a bit of time trying to solve it, and been thinking of maybe
just
trying to work around it,.

Is there maybe a way, instead of a "record is deleted notifcation! that i
can change the message, to say something like "The record for Mr ABC has
been
moved"
So changing the default notification...

thanks in advance


Douglas J. Steele said:
Shouldn't that be

If IsNull(Me!ID) Then
stLinkCriteria = ""
Else
stLinkCriteria = "[ID]=" & Me![ID]
End If

Afraid, though, that I can't see why you'd get a notification. You
shouldn't
be getting any notifications using the Execute method: that's one of its
advantages. The SetWarnings should be unnecessary.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Good Morning
I was hoping someone could possibly assist.

My my after update event, my Docmd. Setwarning False, still tells me i
have
deleted a record after i have set it to False.

I have turned them on and off after and before every command, but it
still
happens

I was told to change the code from docmd.runsql to CurrentDb.Execute
and
still it happens.

Code:
Private Sub OffLettReceived_AfterUpdate()
On Error GoTo Err_Handler

Dim stDocName As String
Dim stLinkCriteria As String
Dim iAnswer As Integer

If IsNull(Me!ID) Then stLinkCriteria = ""
stLinkCriteria = "[ID]=" & Me![ID]


If Me.OffLettReceived = -1 Then

DoCmd.SetWarnings (False)

iAnswer = MsgBox("Would like to move the record for " _
& Me.FirstName & " " & Me.Surname & " " _
& "to the Employee Table?" _
, vbCrLf & vbYesNoCancel)


DoCmd.SetWarnings (True)

If iAnswer = vbYes Then

DoCmd.SetWarnings (False)

Me.Status = "offer"

CurrentDb.Execute "INSERT INTO tblEmpInfo SELECT * FROM TblOffer " &
_
" WHERE [ID] = " & Forms!frmOffer!ID, dbFailOnError

CurrentDb.Execute "DELETE * FROM TblOffer " & _
" Where [ID] = " & Forms!frmOffer!ID, dbFailOnError


Me!CurrOffer.Requery

DoCmd.SetWarnings (True)

Else

DoCmd.Beep

End If

Forms!frmOffer.Requery

DoCmd.SetWarnings True

Exit_Status_Change:
Exit Sub

Err_Handler:
MsgBox Err.Description
Resume Exit_Status_Change

End If
End Sub



I was hoping someone could possible assit where i might be going wrong,
 

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

Similar Threads


Top