Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    antonov is offline Novice
    Windows 10 Access 2016
    Join Date
    Feb 2016
    Posts
    8

    Macro problem

    hello everybody. I have made this program that helps the school keep track of the library. I have the following problem with a subform: the subform is used to lend the book to the kinds. there a 2 buttons: the first one opens another subform where we can search for the book and then lend it (no problem there, it works fine). The second button should get us out of the screen by running the following macro:

    Private Sub Delete_Click()
    DoCmd.Close
    End Sub



    it closes the form ok but in the "non-handling" is visible when I recall the kid (see the attached picture, I circled the error in red) making the program a bit messy. is there a way to improve this?

    Click image for larger version. 

Name:	library.jpg 
Views:	21 
Size:	96.4 KB 
ID:	23591

  2. #2
    vicsaccess's Avatar
    vicsaccess is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Apr 2015
    Posts
    451
    if i understand correctly, if you don't do anything before using the close button you have a strange record? if you look in the table is there unique ID with no values?

  3. #3
    antonov is offline Novice
    Windows 10 Access 2016
    Join Date
    Feb 2016
    Posts
    8
    yes, there is.

  4. #4
    vicsaccess's Avatar
    vicsaccess is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Apr 2015
    Posts
    451
    what's happening is that when you are opening the sub form you are probably using an ID as a reference which is creating a record. there are several ways around this. personally i use unbound forms in this situation with a little bit of code that checks for values and if present saves the record, if no values it closes.

  5. #5
    antonov is offline Novice
    Windows 10 Access 2016
    Join Date
    Feb 2016
    Posts
    8
    This went slightly above my knowledge. how do you unbound a subform?

  6. #6
    vicsaccess's Avatar
    vicsaccess is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Apr 2015
    Posts
    451
    Try a search on unbound forms or post the database and I'll look at it later.

  7. #7
    antonov is offline Novice
    Windows 10 Access 2016
    Join Date
    Feb 2016
    Posts
    8
    It won't let me upload the file. max size is 500 kb and mine is 1000

  8. #8
    vicsaccess's Avatar
    vicsaccess is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Apr 2015
    Posts
    451
    "To provide db: Make copy, remove confidential data, run compact & repair, zip w/Windows Compression if over 500KB (2MB zip allowed), attach to post. Attachment Manager is below the Advanced post editor window, click Go Advanced below the Quick Reply window.
    "

  9. #9
    antonov is offline Novice
    Windows 10 Access 2016
    Join Date
    Feb 2016
    Posts
    8
    I hope this is working. If you get it then i will explain the steps, as all is in Italian
    Attached Files Attached Files

  10. #10
    vicsaccess's Avatar
    vicsaccess is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Apr 2015
    Posts
    451
    yea, i don't recognize any word there, anyone know Italian

  11. #11
    antonov is offline Novice
    Windows 10 Access 2016
    Join Date
    Feb 2016
    Posts
    8
    so you could open it.. great:

    in the switchboard at "Allievo" select one and then press "cerca allievo". a new form will open. Click on "Presta Libro". A new form will open. This is the part where I get the error. Now try and select a book "dettagli libro". Then press "non prestare ed esci (don't lend and exit). you are back to the form "Allievo". Now select the same name to see what happened. Follow the same procedure once again, but this time don't select any book. Don't lend and exit and you will see the "same" problem.

  12. #12
    vicsaccess's Avatar
    vicsaccess is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Apr 2015
    Posts
    451
    interesting work but the language is still getting me. the kid_id loading on form load is whats getting your blank records. try setting an afterupdate event of one of the text boxes to populate the kid_id instead of on load. i tried but not sure what you have there since i can't read it

  13. #13
    antonov is offline Novice
    Windows 10 Access 2016
    Join Date
    Feb 2016
    Posts
    8
    can you post me your trial so that I can see what happens?

  14. #14
    vicsaccess's Avatar
    vicsaccess is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Apr 2015
    Posts
    451
    sorry, couldn't figure out the language. but your kid_id is the problem. unhide it and you'll see. change it from on load to maybe just before update.

  15. #15
    antonov is offline Novice
    Windows 10 Access 2016
    Join Date
    Feb 2016
    Posts
    8

    Thumbs up

    Hello Vic, I found a way. I add "Me.Undo" before "DoCmd.Close" and all works fine.

    Thank you so much for you help

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Macro Problem
    By Lesley in forum Macros
    Replies: 12
    Last Post: 12-09-2013, 03:28 PM
  2. Please help with my MACRO problem
    By archiwill in forum Access
    Replies: 1
    Last Post: 01-09-2013, 01:42 PM
  3. Macro Form problem
    By pippa in forum Forms
    Replies: 0
    Last Post: 04-06-2011, 04:44 AM
  4. active X macro problem
    By stryder09 in forum Access
    Replies: 4
    Last Post: 02-28-2011, 12:13 PM
  5. Macro problem
    By HelenP in forum Forms
    Replies: 3
    Last Post: 10-29-2010, 06:24 AM

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