And how do I address this? Turn on/off Option Explicit?
And how do I address this? Turn on/off Option Explicit?
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?
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.
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
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?
If I do not delete data in the table (tmpLastDate) and then run the Macro then all rows that had data now say #Deleted
Are you still getting the compile error? As you say, it worked in the test db so what has changed?
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.
Send me your new database.
I think I uploaded it twice, sorry about that. let me know if it didn't work
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.
nothing to do with Access 2013 specifically?
I tested it on 2013 and it works fine, nothing different happened.
Thanks, I'll keep working at it and let you know what I figure out. Thanks again for all the assistance!