Page 3 of 4 FirstFirst 1234 LastLast
Results 31 to 45 of 48
  1. #31
    matt704 is offline Advanced Beginner
    Windows 7 64bit Access 2013 64bit
    Join Date
    Jan 2017
    Posts
    49
    And how do I address this? Turn on/off Option Explicit?

  2. #32
    matt704 is offline Advanced Beginner
    Windows 7 64bit Access 2013 64bit
    Join Date
    Jan 2017
    Posts
    49
    I think I'm a little to new to this VBA. I typed rst As DAO.Recordset in

    Public Function GetLastDT()

    Dim rst As DAO.Recordset, rstOut As Recordset, strSQL As String
    Dim HoldID As String, HoldLoc As String, HoldDate As Date

    Is that correct? If so its not working?

  3. #33
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2013 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    What does "not working" mean? Are you getting the same error? Do it also on the next field, rstOut.

    There is some difference between the two databases, or the folders where they reside. Put them both in the same folder, then compile them both. If the test one is ok, check the references. Have both databases open, in VBA editor, with the references windows open and check that they are both the same.

  4. #34
    matt704 is offline Advanced Beginner
    Windows 7 64bit Access 2013 64bit
    Join Date
    Jan 2017
    Posts
    49
    I am continuing to get the "Compile error: User-defined type not defined". I added DAO before Recordset with no luck. I think I'll try to start from scratch and see if I changed something I shouldn't have. I've seen it working in the DB you sent, just an issue running it in my master DB

  5. #35
    matt704 is offline Advanced Beginner
    Windows 7 64bit Access 2013 64bit
    Join Date
    Jan 2017
    Posts
    49
    After deleting all data in the table "tmpLastDate", I ran the code in a Macro this morning in the original test DB you sent me and it did not repopulate the tmpLastDate table. Shouldn't it have done so?

  6. #36
    matt704 is offline Advanced Beginner
    Windows 7 64bit Access 2013 64bit
    Join Date
    Jan 2017
    Posts
    49
    If I do not delete data in the table (tmpLastDate) and then run the Macro then all rows that had data now say #Deleted

  7. #37
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2013 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Are you still getting the compile error? As you say, it worked in the test db so what has changed?

  8. #38
    matt704 is offline Advanced Beginner
    Windows 7 64bit Access 2013 64bit
    Join Date
    Jan 2017
    Posts
    49
    In an effort to really understand what was going on, I started from scratch. The two previous comments came from using the DB you sent me. I fixed the one error in the VBA code (changed HoldDate = rst!DateOf to "EventDateAndTime") and then ran a macro with GetLastDT() and the result is "#Deleted" in all rows for all fields in the "tmpLastDate" table. I'm trying to figure out why it didn't replace the existing data with the same data you sent in the "tmpLastDate" table AND if I delete all rows in tmpLastDate and then run the Macro, no rows are filled.

  9. #39
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2013 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Send me your new database.

  10. #40
    matt704 is offline Advanced Beginner
    Windows 7 64bit Access 2013 64bit
    Join Date
    Jan 2017
    Posts
    49

  11. #41
    matt704 is offline Advanced Beginner
    Windows 7 64bit Access 2013 64bit
    Join Date
    Jan 2017
    Posts
    49
    I think I uploaded it twice, sorry about that. let me know if it didn't work

  12. #42
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2013 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    It works fine for me, you've done everything right. The problem must lie externally to Access, such as I said before - the folder permissions, missing references, the way Access is installed, how the pc is set up. You may want to start another thread on this and get some experts (!) to help you.

  13. #43
    matt704 is offline Advanced Beginner
    Windows 7 64bit Access 2013 64bit
    Join Date
    Jan 2017
    Posts
    49
    nothing to do with Access 2013 specifically?

  14. #44
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2013 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    I tested it on 2013 and it works fine, nothing different happened.

  15. #45
    matt704 is offline Advanced Beginner
    Windows 7 64bit Access 2013 64bit
    Join Date
    Jan 2017
    Posts
    49
    Thanks, I'll keep working at it and let you know what I figure out. Thanks again for all the assistance!

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

Similar Threads

  1. Replies: 11
    Last Post: 07-16-2016, 11:38 AM
  2. Replies: 6
    Last Post: 04-19-2016, 03:58 PM
  3. Replies: 7
    Last Post: 09-02-2014, 08:18 AM
  4. Subtracting a date/time field from a number to get date/time
    By Lifeseeker1019 in forum Programming
    Replies: 4
    Last Post: 03-28-2014, 12:59 PM
  5. Replies: 5
    Last Post: 03-19-2014, 02:31 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