Results 1 to 14 of 14
  1. #1
    emilyrogers is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Oct 2010
    Posts
    46

    My form seems to behave differently with windows 7 vs windows xp?!?

    I have a form which saves a record to a table and this works fine. however when you press save and close i get two popups saying "Forms!DataEntryDrawingNumbers!List94" and then the same again saying List 85 at the end. however when I added DoCmd.SetWarnings False after the code previously behind the save and close button it seemed to suppress these pop ups. however then someone else tried to use this database on a computer that runs windows 7 versus windows xp on my computer they appeared again.

    would this have any affect on my code. if not what do you think the problem could be?

    Thanks ahead of time.

    This is the code behind my save and close button
    On Error GoTo Err_close_form_Click


    DoCmd.SetWarnings False

    Dim stDocName As String

    DoCmd.RunCommand acCmdRefresh

    RunCommand acCmdSaveRecord

    DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70




    stDocName = "AddNewRecordtoDrawingList"
    DoCmd.OpenQuery stDocName, acNormal, acEdit

    stDocName = "DeleteTempDrawingRecord"
    DoCmd.OpenQuery stDocName, acNormal, acEdit

    stDocName = "update drawing number"
    DoCmd.OpenQuery stDocName, acNormal, acEdit



    DoCmd.SetWarnings True
    DoCmd.SetWarnings False
    DoCmd.Close


    Exit_close_form_Click:
    Exit Sub

    Err_close_form_Click:
    MsgBox Err.Description
    Resume Exit_close_form_Click

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,530
    Hi

    I would sugest that you remove the DoCmd.SetWarnings False code and then step through your code one line at a time to see what is causing the pop up messages.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    emilyrogers is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Oct 2010
    Posts
    46
    Quote Originally Posted by Bob Fitz View Post
    Hi

    I would sugest that you remove the DoCmd.SetWarnings False code and then step through your code one line at a time to see what is causing the pop up messages.

    How would i "step through" the code?
    The function of the code works it save the record it just has these popups before it does. I have looked at the queries called up in this code but there seems to be no reason for the popups.

    I am working with Access 2007 and he is working with Access 2010. would that make a difference??

    thanks!

  4. #4
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,530
    Hi

    How would i "step through" the code?
    Open the VBE editor and find the On Click event code for the "save and close" button. Left click your mouse in the narrow column next to the first line of code. This will cause a small brown dot to appear in the column. Return to the form and click the "save and close" button. The VBE editor window will open. Execution of code will be suspended and the first line of code will be highlighted. Now press the F8 function key. Each press of F8 will cause the next line of code to run. Continue using F8 untill you find which bit of code is causing the pop up.

    I am working with Access 2007 and he is working with Access 2010. would that make a difference??
    I have not used either of these (I use A2003) so I can not give you a Yes/No answer I'm afraid.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  5. #5
    emilyrogers is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Oct 2010
    Posts
    46
    Thank you, your description of how to "step through" the code was detailed and helpful. unfortunately the problem only occurs when I am in not in design mode. eg when i come in as a normal user. without having access to the behind the scenes part of the forms etc. how would you suggest to tackle the problem?
    I stepped through the code anyway and i got no popups- it just highlighted each line in turn and then closed the window.

    Quote Originally Posted by Bob Fitz View Post
    Hi


    Open the VBE editor and find the On Click event code for the "save and close" button. Left click your mouse in the narrow column next to the first line of code. This will cause a small brown dot to appear in the column. Return to the form and click the "save and close" button. The VBE editor window will open. Execution of code will be suspended and the first line of code will be highlighted. Now press the F8 function key. Each press of F8 will cause the next line of code to run. Continue using F8 untill you find which bit of code is causing the pop up.


    I have not used either of these (I use A2003) so I can not give you a Yes/No answer I'm afraid.

  6. #6
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,530
    Hi

    Can you confirm that you removed the "DoCmd.SetWarnings False" before stepping through the code?
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  7. #7
    emilyrogers is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Oct 2010
    Posts
    46
    Yes, before I stepped through the code my code looked like this. and as i pressed F8 and went through i got the popups that had been supressed by the "DoCmd.SetWarnings False" that had been at the begining but nothing else. unfortunately i onyl get the popups when not in design mode. thank you for being so patient!

    Private Sub close_form_Click()

    On Error GoTo Err_close_form_Click


    Dim stDocName As String

    DoCmd.RunCommand acCmdRefresh

    RunCommand acCmdSaveRecord

    DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70




    stDocName = "AddNewRecordtoDrawingList"
    DoCmd.OpenQuery stDocName, acNormal, acEdit

    stDocName = "DeleteTempDrawingRecord"
    DoCmd.OpenQuery stDocName, acNormal, acEdit

    stDocName = "update drawing number"
    DoCmd.OpenQuery stDocName, acNormal, acEdit



    DoCmd.SetWarnings True
    DoCmd.Close




    Exit_close_form_Click:
    Exit Sub

    Err_close_form_Click:
    MsgBox Err.Description
    Resume Exit_close_form_Click
    End Sub

    Quote Originally Posted by Bob Fitz View Post
    Hi

    Can you confirm that you removed the "DoCmd.SetWarnings False" before stepping through the code?

  8. #8
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    You say a couple of different things in your posts

    Is one of you using Access 2003 (where it works)
    and one of you is using Access 2007 (where it doesn't?)

    Is there any way you can upload a copy of the database (2003 if you can) so we can take a look at it.

    I suspect it is failing on the domenuitem particularly if it's working in a version of access prior to 2007 and not after.

  9. #9
    emilyrogers is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Oct 2010
    Posts
    46
    Quote Originally Posted by rpeare View Post
    You say a couple of different things in your posts

    Is one of you using Access 2003 (where it works)
    and one of you is using Access 2007 (where it doesn't?)

    Is there any way you can upload a copy of the database (2003 if you can) so we can take a look at it.

    I suspect it is failing on the domenuitem particularly if it's working in a version of access prior to 2007 and not after.

    Now it appears not to work in either Access 2007 or Access 2010. the error only appears in view mode rather than design mode.

    i think the database is too large to upload. its 38.2MB

  10. #10
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,530
    Hi

    You may like to try replacing:
    Code:
    DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
    With:
    Code:
     
    If Me.Dirty Then Me.Dirty = False
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  11. #11
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    You can zip the file, databases compress very nicely, then upload it.

  12. #12
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    Try putting some breaks in your code with message boxes (since it's not a module) like this:

    Code:
    Private Sub close_form_Click()
    
    On Error GoTo Err_close_form_Click
    
        Dim stDocName As String
        
    msgbox "before first command"
        DoCmd.RunCommand acCmdRefresh
            msgbox "before second command"
        RunCommand acCmdSaveRecord
            msgbox "before third command"
      DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
    msgbox "before fourth command"
    
    stDocName = "AddNewRecordtoDrawingList"
        DoCmd.OpenQuery stDocName, acNormal, acEdit
        
        stDocName = "DeleteTempDrawingRecord"
        DoCmd.OpenQuery stDocName, acNormal, acEdit
        
        stDocName = "update drawing number"
        DoCmd.OpenQuery stDocName, acNormal, acEdit
    DoCmd.SetWarnings True
        DoCmd.Close
        
    Exit_close_form_Click:
        Exit Sub
        
    Err_close_form_Click:
        MsgBox Err.Description
        Resume Exit_close_form_Click
    End Sub
    I am almost convinced it's the domenu item that is causing your problem. You can save a record without using a menu item, you can also save forms, reports, etc without using a menu item.

    If you're just trying to save the record you can do something like

    Code:
    DoCmd.GoToRecord , , acNewRec
    instead of the domenuitem then proceed with the rest of your code.

  13. #13
    emilyrogers is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Oct 2010
    Posts
    46

    Talking

    Quote Originally Posted by rpeare View Post
    I am almost convinced it's the domenu item that is causing your problem. You can save a record without using a menu item, you can also save forms, reports, etc without using a menu item.

    If you're just trying to save the record you can do something like

    Code:
    DoCmd.GoToRecord , , acNewRec
    instead of the domenuitem then proceed with the rest of your code.

    Thank you so much when I replaced the DoMenuItem with what you suggested the problem appears to have gone away!!! however would you be able to explain to me what each part of the domenuitem does so that i can be sure that the change in code will not have repercussions other places in the database?? also.... why would this problem suddenly just occur? when the database has been working fine for weeks?


    THANKS!!!

  14. #14
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    The domenuitem is literally following the steps you would take if you were using your mouse.

    If you have your form open you click on the RECORDS menu item then SAVE RECORD this is basically what your particular do menuitem is performing.

    Because Access2007+ no longer uses the intuitive menus that it did in all prior versions newer versions do not know how to interpret your command line.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. 2010 windows vs. tabs
    By benjammin in forum Access
    Replies: 3
    Last Post: 05-24-2011, 01:33 PM
  2. mdb file won't open in Windows 7
    By Nice in forum Access
    Replies: 2
    Last Post: 02-16-2011, 12:42 PM
  3. Replies: 3
    Last Post: 07-15-2010, 05:53 PM
  4. Windows 7 and OLE object in a Form
    By TJ_Hahn in forum Access
    Replies: 3
    Last Post: 05-28-2010, 06:06 AM
  5. Windows Themes and Access Form
    By JDrown4 in forum Access
    Replies: 3
    Last Post: 04-21-2010, 03:08 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums