Page 2 of 4 FirstFirst 1234 LastLast
Results 16 to 30 of 53
  1. #16
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Have you single stepped the code or set a breakpoint to see if that line appears to be executing?

  2. #17
    jpkeller55 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Sep 2010
    Posts
    169
    I have never single stepped a code before...Is that difficult to do?

    I have tested that it all functions fine if a new record is inserted and if the module is called on a single form with no subform. It is just the edits on the Form/subform that are not getting populated correctly to the Audit trail field (Updates). How can I single step this code? Thanks for your assistance. I am very close to solving this with yours and Adam's help.

  3. #18
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    While looking at the code, left click outside of the edit margin and you will place a breakpoint on that line. It needs to be a line that actually executes and not just a documentation line. Then run the form and when that line is reached the editor will pop up on that line. Pressing the F8 key single steps and hovering over a variable will pop up the value of the variable in a baloon. F5 will let the code take off again if you want. Make no changes to the code while in this debug mode as it has been know to cause corruption.

  4. #19
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    keller,

    make sure to that if you're hovering over var's in the code, to do so AFTER the execution passes the line. code execution does not take place until after the code is read (e.g. - when your yellow line highlights the next line)

    Hey Allen, thanks for that corruption tip. Didn't know that.

  5. #20
    jpkeller55 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Sep 2010
    Posts
    169
    OK, I figured out how to step through the code based on your instructions. I will take a deeper look at this in a bit. Thanks!

  6. #21
    jpkeller55 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Sep 2010
    Posts
    169
    I have stepped through the code. When I enter a new record, the code stops at the break point per the screen shot. When I try to edit a record, it stops at the breakpoint but there is too much data to see in the hover over. I can't see the full value. I am not sure what I am looking for.

  7. #22
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    keller,

    type "?chr(10)" and "?chr(13)" in the immediate window. it doesn't return anything. what did you mean those to be? that is one problem for sure. Access is giving you boxes I think because they don't have any return values.

    Not sure, just throwing that out there. Allen will probably be able to help you more than I. He's got much more experience.

  8. #23
    jpkeller55 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Sep 2010
    Posts
    169
    the chr(10) and chr(13) are just adding a new line in the field I believe. From the attached screen shot, you can see how the code is failing to put the date and time for the two edits that I made to a question. It did capture the new record date and time.

  9. #24
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    keller,

    to be honest with you, I'm not sure by looking at the shots. I'm sure you can get it fix by uploading the file or a portion of it here. I'm out of ideas without looking at it directly. I'm almost certain it's something simple, but it's a lot easier to look at it on my own screen than going through many more posts back and forth to figure it out.

    If you can't upload, I'm sure someone else will be able to spot it...

  10. #25
    jpkeller55 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Sep 2010
    Posts
    169
    Wont be able to publicly post the file at this time, but I appreciate any insight.

  11. #26
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Quote Originally Posted by ajetrumpet View Post
    keller,

    type "?chr(10)" and "?chr(13)" in the immediate window. it doesn't return anything. what did you mean those to be? that is one problem for sure. Access is giving you boxes I think because they don't have any return values.

    Not sure, just throwing that out there. Allen will probably be able to help you more than I. He's got much more experience.
    Adam,
    Chr(13) = CarriageReturn and Chr(10) = LineFeed. Both are control codes in ASCII and so there is nothing to display. It is just like vbCrLf.

  12. #27
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    thank you Allen. I did misread those when they outputted. I never test chr() because never really use them.

  13. #28
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    What kind of field is the Updates field? Memo, Text? How about using some Debug.Print statements to write this field to the immediate window as a diagnostic tool?

  14. #29
    jpkeller55 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Sep 2010
    Posts
    169
    I am pretty sure I have figured out what is going on here but not sure how to fix. I think the reason the characters in this command are not populating the tblQuestions.Updates when I use a form with a subform but does print when only using a form with no subform.
    Code:
    "Changes made on " & Now() & " by " & Environ("USERNAME") & ";"
    Because the audit trail could potentially go to two different UPDATES fields (tblQuestions.Updates and tblQuestResponseSets.Updates) when data exists in the subform, Access is reading the controls associated with the subform first and then the controls on the main form. The above code is populating correctly to the tblQuestResponseSets.Updates where the responses are stored. But once Access has finished reading the subform controls it then moves on to the main form controls. The audit trail for this is stored in tblQuestions.Updates. Since the code already wrote the "Changes made on...." to the tblQuestResponseSets nothing gets printed to the tblQuestions.Updates. Does this sound reasonable and if so can the code be tweaked to fix?

    Updates field is memo by the way.
    Last edited by jpkeller55; 09-16-2010 at 04:20 PM. Reason: Added updates is memo field

  15. #30
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    j,

    even if the there are two UPDATES fields, that shouldn't be a problem because you are directly referencing the correct field with the MYFORM variable. Could it be maybe that it IS actually writing twice like you want, but it is writing the same data to the same field twice because the MYFORM variable is the same both times?

    I took a look more closely and it is a bit confusing of how it is working. I did think of that though, so I thought I would mention...

Page 2 of 4 FirstFirst 1234 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. audit Log
    By mwabbe in forum Access
    Replies: 42
    Last Post: 05-30-2011, 07:23 AM
  2. Audit trail question #2
    By jpkeller55 in forum Access
    Replies: 9
    Last Post: 09-13-2010, 05:55 PM
  3. Audit trail question
    By jpkeller55 in forum Access
    Replies: 5
    Last Post: 09-13-2010, 04:12 PM
  4. Filter By Form not working!
    By Freybourne in forum Access
    Replies: 6
    Last Post: 06-22-2010, 09:41 PM
  5. Replies: 1
    Last Post: 09-28-2009, 05:21 PM

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