Page 1 of 3 123 LastLast
Results 1 to 15 of 36
  1. #1
    fabiobarreto10 is offline Competent Performer
    Windows 7 32bit Access 2007
    Join Date
    Dec 2011
    Posts
    169

    historical dates for


    I have a form with a subform. I have a field in the subform datareprogramada. The user can delete this and insert a new date. All I need to do a history of these dates. I tried to do a sub into the sub, but could not. Does anyone have any tips?

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,816
    In addition to info in your other thread, see http://access.mvps.org/access/modules/mdl0021.htm
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    fabiobarreto10 is offline Competent Performer
    Windows 7 32bit Access 2007
    Join Date
    Dec 2011
    Posts
    169
    June, The first thing I downloaded contain errors. I tried to get the idea but could not. The last you sent the access was 97 when I did the conversion to access 2007, appeared a lot of error. Do you have another model, or some site where I can search?

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,816
    Those were result of Google search. Here is one more and that exhausts my search effort http://allenbrowne.com/appaudit.html

    Allen Browne normally has good product.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    fabiobarreto10 is offline Competent Performer
    Windows 7 32bit Access 2007
    Join Date
    Dec 2011
    Posts
    169
    June, just a guideline.

    sKeyField = name of the AutoNumber field. (ok I put the name)
    lngKeyValue = Value of the AutoNumber field .(???????????). What value should I enter?

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,816
    lngKeyValue is one of the variables declared in the function declaration:

    Function AuditDelBegin(sTable As String, sAudTmpTable As String, sKeyField As String, lngKeyValue As Long) As Boolean

    These variables are function arguments. You must pass values to the function when the function is called. You call the function is some event procedure, like:

    x = AuditDelBegin("your table name", "audit table name", "name of the field", Nz(Me.KeyFieldname,0))

    Values between the quotes will be literal strings, not variables. The lngKeyValue is captured by referencing the field on the form. This is a variable.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    fabiobarreto10 is offline Competent Performer
    Windows 7 32bit Access 2007
    Join Date
    Dec 2011
    Posts
    169
    Just to confirm:

    Function AuditEditBegin(sTable As String, sAudTmpTable As String, sKeyField As String, _
    lngKeyValue As Long, bWasNewRecord As Boolean) As Boolean

    Function AuditEditBegin(TblPassosStatus As String, audTblPassosStatus As String, CodPassosStatus As String, _
    Nz (Me.CodPassosStatus, 0))As Long, bWasNewRecord As Boolean) As Boolean

  8. #8
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,816
    No. Do not change the function declaration. You pass data to the function arguments by calling the function.

    You should do some self-educating on how to build and use custom function.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  9. #9
    fabiobarreto10 is offline Competent Performer
    Windows 7 32bit Access 2007
    Join Date
    Dec 2011
    Posts
    169
    June,

    I made a different database, (attached) just to test the model of Allen.
    I did exactly as he describes, including table names and key.
    But there was a runtime error.
    Is it because of my version of Access?

  10. #10
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,816
    It errors when trying to run the LogError function. Run Debug>Compile and the compiler will error on the LogError function call. Always Debug>Compile after VBA edits. Refer to link at bottom of my post for tutorial on debugging techniques. Allen Browne states in his article:
    3. Either remove the four references to function LogError(), or set up error logging as described in Error Handling.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  11. #11
    fabiobarreto10 is offline Competent Performer
    Windows 7 32bit Access 2007
    Join Date
    Dec 2011
    Posts
    169
    That's what I did. I removed the four references to LogError function (). If the db I sent you was with the references, it is because I did a test with the references

  12. #12
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,816
    You are using tblInvoice as the table name in the function calls. There is no table with this name. Change to sTable.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  13. #13
    fabiobarreto10 is offline Competent Performer
    Windows 7 32bit Access 2007
    Join Date
    Dec 2011
    Posts
    169
    June7,

    In my bank test worked perfectly. I see now how is the officer.

    The fact that I have put all the instructions on how to goto err comments will have any difference in performance?
    I would put a column in my subform count the number of times that the rescheduled date was changed. As this counter increment every change of date rescheduled?
    In the event rescheduled date after upgrading, I was thinking something like:
    A while statement
    Me.contador= Me.contador + 1
    How do the syntax. The counter must start with zero, because the first record of the rescheduled date is not an issue.

    Thank you.

  14. #14
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,816
    Lack of error handler means any error that could crash or lock up the code excecution is not managed. Otherwise, not performance issue.

    Why count times changed? Counter code not practical. Where would you save this number for future reference? This number could be calculated by query on the audit table. In the event that commits record to audit table, use DCount function to count the records in audit table with the target record's ID and set textbox to this value, something like:

    Me.textboxname = DLookup("fieldname", "tablename", "ID=" & Me.ID)
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  15. #15
    fabiobarreto10 is offline Competent Performer
    Windows 7 32bit Access 2007
    Join Date
    Dec 2011
    Posts
    169
    Forgive my ignorance. What error that can occur and code execution fails?
    The error handler function is to tell where the error?
    confirming:
    I want to create a field in my subform to the counter, do not want a text box.
    In the after update event of the rescheduled date field put:
    Me.Counter = DCount ("Field Name", "tablename", "ID =" & Me.ID)
    Is that it?

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

Similar Threads

  1. Historical data
    By Accessgrasshopper in forum Access
    Replies: 0
    Last Post: 02-28-2011, 06:39 PM
  2. Replies: 3
    Last Post: 02-04-2011, 07:32 AM
  3. Replies: 1
    Last Post: 12-09-2010, 08:29 AM
  4. Mixed dates - show only complete dates?
    By weeblesue in forum Queries
    Replies: 3
    Last Post: 10-27-2010, 02:15 PM
  5. Query using historical table
    By kwilliams5675 in forum Queries
    Replies: 1
    Last Post: 10-05-2010, 03:23 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