Go Back   Access World Forums > Microsoft Access Discussion > Forms

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 09-24-2019, 09:14 PM   #1
scallebe
Newly Registered User
 
Join Date: Mar 2018
Posts: 51
Thanks: 29
Thanked 1 Time in 1 Post
scallebe is on a distinguished road
Microsoft access warning

Good morning Specialists,

After input my form fields I click a button to create a mail. Works fine.

Before the "email code" starts, the user has the possibility to save the record and continue or not and cancel.

Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim strMsg As String
Dim iResponse As Integer
   
   ' Specify the message to display.
   Beep
   strMsg = "Wil je deze aanvraag bewaren?" & vbLf & "Klik ''Yes'' om te bewaren of ''No'' om af te sluiten." & vbLf & vbLf
   strMsg = strMsg & "Voulez-vous enregistrer cette demande?" & vbLf & "Cliquez sur ''Yes'' pour enregistrer ou sur ''No'' pour fermer." ' Display the message box.
   iResponse = MsgBox(strMsg, vbQuestion + vbYesNo, "Save Record?")
        
        ' Check the user's response.
        If iResponse = vbNo Then
           ' Undo the change.
           Me.Undo
           ' Cancel the update.
           Cancel = True
        End If
Hoeveel.SetFocus
End Sub
When clicked "Yes" the code continues and the email appears. So far so good.

When clicke "No" I have a message :

The setting you entered isn't valid for this property.

I click OK, the form is reseted and I can restart the process.

Why do I get this message?

Thanks

Greetz

Pascal

scallebe is offline   Reply With Quote
Old 09-24-2019, 09:22 PM   #2
JHB
Have been here a while
 
Join Date: Jun 2012
Location: In the south of Denmark (Jutland), near the German border.
Posts: 7,720
Thanks: 3
Thanked 2,082 Times in 2,037 Posts
JHB has a spectacular aura about JHB has a spectacular aura about
Re: Microsoft access warning

Try to comment out the "Me:Undo".
__________________
If the above post has helped you, why not take the time to say thank you, by pressing the "Thumbs up."
JHB is offline   Reply With Quote
The Following User Says Thank You to JHB For This Useful Post:
scallebe (09-24-2019)
Old 09-24-2019, 09:48 PM   #3
scallebe
Newly Registered User
 
Join Date: Mar 2018
Posts: 51
Thanks: 29
Thanked 1 Time in 1 Post
scallebe is on a distinguished road
Re: Microsoft access warning

JHB,

Thanks for reply

But I don't know what you mean…

scallebe is offline   Reply With Quote
Old 09-24-2019, 10:01 PM   #4
JHB
Have been here a while
 
Join Date: Jun 2012
Location: In the south of Denmark (Jutland), near the German border.
Posts: 7,720
Thanks: 3
Thanked 2,082 Times in 2,037 Posts
JHB has a spectacular aura about JHB has a spectacular aura about
Re: Microsoft access warning

The line marked with red:
Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim strMsg As String
Dim iResponse As Integer
   
   ' Specify the message to display.
   Beep
   strMsg = "Wil je deze aanvraag bewaren?" & vbLf & "Klik ''Yes'' om te bewaren of ''No'' om af te sluiten." & vbLf & vbLf
   strMsg = strMsg & "Voulez-vous enregistrer cette demande?" & vbLf & "Cliquez sur ''Yes'' pour enregistrer ou sur ''No'' pour fermer." ' Display the message box.
   iResponse = MsgBox(strMsg, vbQuestion + vbYesNo, "Save Record?")
        
        ' Check the user's response.
        If iResponse = vbNo Then
           ' Undo the change.
           'Me.Undo
           ' Cancel the update.
           Cancel = True
        End If
Hoeveel.SetFocus
End Sub
__________________
If the above post has helped you, why not take the time to say thank you, by pressing the "Thumbs up."
JHB is offline   Reply With Quote
The Following User Says Thank You to JHB For This Useful Post:
scallebe (09-24-2019)
Old 09-24-2019, 10:29 PM   #5
scallebe
Newly Registered User
 
Join Date: Mar 2018
Posts: 51
Thanks: 29
Thanked 1 Time in 1 Post
scallebe is on a distinguished road
Re: Microsoft access warning

JHB,

Thanks.

I already try that. I'm having the same message and my Form doesn't clear.
scallebe is offline   Reply With Quote
Old 09-24-2019, 10:56 PM   #6
JHB
Have been here a while
 
Join Date: Jun 2012
Location: In the south of Denmark (Jutland), near the German border.
Posts: 7,720
Thanks: 3
Thanked 2,082 Times in 2,037 Posts
JHB has a spectacular aura about JHB has a spectacular aura about
Re: Microsoft access warning

Could you post your database with some sample data, zip it!
__________________
If the above post has helped you, why not take the time to say thank you, by pressing the "Thumbs up."
JHB is offline   Reply With Quote
Old 09-24-2019, 11:05 PM   #7
arnelgp
error reading drive A:
 
arnelgp's Avatar
 
Join Date: May 2009
Location: somewhere out there
Posts: 8,569
Thanks: 68
Thanked 2,745 Times in 2,630 Posts
arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice
Re: Microsoft access warning

not tested, but you can try adding code
to the form's Error event:
Code:
Private Sub Form_Error(DataErr As Integer, Response As Integer)
    Debug.Print DataErr
    Response = acDataErrContinue
End Sub

__________________
"Never stop learning, because life never stops teaching"
arnelgp is offline   Reply With Quote
The Following User Says Thank You to arnelgp For This Useful Post:
scallebe (09-25-2019)
Old 09-25-2019, 01:14 AM   #8
scallebe
Newly Registered User
 
Join Date: Mar 2018
Posts: 51
Thanks: 29
Thanked 1 Time in 1 Post
scallebe is on a distinguished road
Re: Microsoft access warning

#JHB, #arnelgp

Thanks for reply.

#arnelgp : I have the same result with your solution.

I mannaged to reduce my DB with the form in question.

Fill in the green fields, click next and click then "NO". The message will apear.

Example.zip

I hope the example works…

Thanks a lot

Greetz

Pascal
scallebe is offline   Reply With Quote
Old 09-25-2019, 01:56 AM   #9
JHB
Have been here a while
 
Join Date: Jun 2012
Location: In the south of Denmark (Jutland), near the German border.
Posts: 7,720
Thanks: 3
Thanked 2,082 Times in 2,037 Posts
JHB has a spectacular aura about JHB has a spectacular aura about
Re: Microsoft access warning

I do not get the error you mention, (but something else according to the Error$)!

Did you try the database you posted?

Do a "Compact & Repair".


And please next time, if you want people to help you: DON'T Lock anything in the database.
__________________
If the above post has helped you, why not take the time to say thank you, by pressing the "Thumbs up."
JHB is offline   Reply With Quote
The Following User Says Thank You to JHB For This Useful Post:
scallebe (09-25-2019)
Old 09-25-2019, 02:16 AM   #10
arnelgp
error reading drive A:
 
arnelgp's Avatar
 
Join Date: May 2009
Location: somewhere out there
Posts: 8,569
Thanks: 68
Thanked 2,745 Times in 2,630 Posts
arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice
Re: Microsoft access warning

check the single change in the code.
Attached Files
File Type: zip Example_2.zip (124.9 KB, 6 views)
__________________
"Never stop learning, because life never stops teaching"
arnelgp is offline   Reply With Quote
The Following User Says Thank You to arnelgp For This Useful Post:
scallebe (09-25-2019)
Old 09-25-2019, 03:11 AM   #11
scallebe
Newly Registered User
 
Join Date: Mar 2018
Posts: 51
Thanks: 29
Thanked 1 Time in 1 Post
scallebe is on a distinguished road
Re: Microsoft access warning

#JHB,

I still have the same error, even with the database I posted. Even after Compact & repair...

See photo…


#arnelgp,

Your solution is working…

Can you please tell me what you changed? If I compere your code with the original I send as example, I can not see immediately the difference …

Thanks

Greetz

Pascal
Attached Images
File Type: jpg Access message.JPG (62.0 KB, 10 views)
scallebe is offline   Reply With Quote
Old 09-25-2019, 04:31 AM   #12
arnelgp
error reading drive A:
 
arnelgp's Avatar
 
Join Date: May 2009
Location: somewhere out there
Posts: 8,569
Thanks: 68
Thanked 2,745 Times in 2,630 Posts
arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice
Re: Microsoft access warning

on the click event of "Next" button,
you set:

If Me.Dirty Then Me.Dirty=False

Me.Dirty=False, conflicts with BeforeUpdate event.

the solution is check if the form is dirty,
and pass it to BeforeUpdate event:

If Me.Dirty Then Call Form_BeforeUpdate(0)
__________________
"Never stop learning, because life never stops teaching"
arnelgp is offline   Reply With Quote
The Following User Says Thank You to arnelgp For This Useful Post:
scallebe (09-25-2019)
Old 09-25-2019, 09:49 AM   #13
scallebe
Newly Registered User
 
Join Date: Mar 2018
Posts: 51
Thanks: 29
Thanked 1 Time in 1 Post
scallebe is on a distinguished road
Re: Microsoft access warning

#arnelgp,

Thanks for reply.

It's not working yet like it supose to…

I'm gonna do my best to explane…

What happens in the orignal version :

I fill in the different fields in the "Verlofaanvraag" Form. After input I click NEXT.
the "msgBox" apears to save the record or not.
After click Yes, a form "FormOpgelet" opens (with a last warning and a small explanation for the user).
In that form I click OK, the record in the "Verlofaanvraag" form gets saved, the warningform closes and the email starts up.
I send the mail, if not I close the mail without save.
I close the "Verlofaanvraag" form.

When I click No in the "msgbox", The inputs are removed from the form (blank form) and I can restart the process or close the form.

Of course with the message after clicking No : "The setting you entered isn't valid for this property."


What happens with your change of code :

I fill in the different fields in the "Verlofaanvraag" Form. After input I click NEXT.
the "msgBox" apears to save the record or not.
After click Yes, the form "FormOpgelet" opens (with a last warning and a small explanation for the user).
In that form I click OK, the record in the "Verlofaanvraag" form IS NOT saved yet, the warningform closes and the email starts up.
I send the mail, if not I close the mail without save.
When I close the "Verlofaanvraag" form. The "msgBox" (save Yes-No) appears again. If I click Yes, the warning form opens again and when I click Cancel the Warningform closes, The FormVerlofaanvraag" is already closed and the record is saved. (I can see that when I reopen)

When I click No in the "msgbox" (save Yes-No), The WarningForm apears again (and that should not happen, so I click Cancel otherwise the email will start again) The inputs are removed from the form (blank form) and I can restart the process or close the form.

Of course this time without the message : "The setting you entered isn't valid for this property."

So the whole process is doing a little strange Now….

Greetz

Pascal
scallebe is offline   Reply With Quote
Old 09-25-2019, 11:57 AM   #14
arnelgp
error reading drive A:
 
arnelgp's Avatar
 
Join Date: May 2009
Location: somewhere out there
Posts: 8,569
Thanks: 68
Thanked 2,745 Times in 2,630 Posts
arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice
Re: Microsoft access warning

I see, try again pascale
Attached Files
File Type: zip Example_2.zip (129.7 KB, 5 views)
__________________
"Never stop learning, because life never stops teaching"
arnelgp is offline   Reply With Quote
The Following User Says Thank You to arnelgp For This Useful Post:
scallebe (09-25-2019)
Old 09-25-2019, 09:07 PM   #15
scallebe
Newly Registered User
 
Join Date: Mar 2018
Posts: 51
Thanks: 29
Thanked 1 Time in 1 Post
scallebe is on a distinguished road
Re: Microsoft access warning

Good morning arnelgp,

Thanks for reply

I figgered out the changes you did…

One thing didn't work yet :

When the "msgBox" apears (to save the record or not), I click to No and the "WarningForm" opens again (and that should not happen) so I added the following code in this part (your schanges) :

Code:
    If Me.Dirty Then
        Dim strMsg As String
        Dim iResponse As Integer
        ' Specify the message to display.
        Beep
        strMsg = "Wil je deze aanvraag bewaren?" & vbLf & "Klik ''Yes'' om te bewaren of ''No'' om af te sluiten." & vbLf & vbLf
        strMsg = strMsg & "Voulez-vous enregistrer cette demande?" & vbLf & "Cliquez sur ''Yes'' pour enregistrer ou sur ''No'' pour fermer." ' Display the message box.
        iResponse = MsgBox(strMsg, vbQuestion + vbYesNo, "Save Record?")
                
        ' Check the user's response.
        If iResponse = vbNo Then
           ' Undo the change.
           Me.Undo
   --> Exit Sub <--
       ' Cancel the update.
        Else
            On Error Resume Next
            bolErrorHandled = True
            DoCmd.RunCommand acCmdSaveRecord
            bolErrorHandled = False
            On Error GoTo 0
        End If
        Me.Hoeveel.SetFocus
    
    End If
Is this correct? Or is there another way to solve this?

Thanks

Greetz

Pascal

scallebe is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Microsoft][ODBC Microsoft Access Driver] Too many client tasks. juanvan General 10 05-15-2017 08:12 AM
Microsoft Security Warning - Hyperlinks henryihunter1954 Forms 5 05-14-2017 01:29 PM
Question Link Microsoft Outlook Contacts to Microsoft Access Mohsin Malik General 3 06-13-2016 12:05 AM
Microsoft Access is redundant technology and no longer supported by Microsoft Groundrush The Watercooler 17 06-23-2012 11:14 PM
Question Microsoft Works Database v. Microsoft Access akt01 General 10 02-02-2009 03:01 PM




All times are GMT -8. The time now is 01:06 AM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World