AboutRichard Rost Expertise I am happy to answer any kinds of questions about Microsoft Access - from basic table design to advanced VBA programming. Also, please feel free to check the Access Tips & Tricks section of my web site.
Education/Credentials I am a self-taught Access expert. I have been building databases for clients since the early 90s. You can see a sample of my Access Tutorials on my web site at 599CD.com
I am new to Access (but ok at vba in excel) and have being trying to find the answer to what must be a simple question.
I use a "homepage" form which has buttons on it that run various macro's that in turn run queries in my db checking important data.
I would like to record the last time that the button was pressed so i can see the last time the data was checked (tmy aim is that this date / time would show on the "homepage" form to identify checks not carried out recently) to do this I set up a simple table with two columns
1. Query Name
2. Date/time modified
I want the macro (which runs the specific query related to column 1) to select the approriate row for the data being checked in column 1 and then to offset and populate the date/time field.
Some of this I ahve managed to achieve but I have two main problems:
1. How do I select a specific row based on the contents of a column?
2. How would I then offsett to the modified column?
3. How do I replace the last modified date (which may be NULL if never populated) with the current modified date.
Many thanks,
Answer If all you care about is the LAST date that a macro was run (and you don't need to store a complete history) then I would just make a table with ONE record in it and a field for each macro name.
Macro1Date
Macro2Date
Macro3Date
etc.
Now, bind your "homepage" form to this table, and when the button is clicked to run that macro, just set the value of the field for that macro:
Macro1Date = Now()
DoCmd.RunMacro "Macro1Name"
Now, hide the record selectors and navigation buttons on that form (and it won't look like it contains any data, but it does) and then put invisible text boxes for each of your fields on the form so you can set their values… then voila, you're good to go.
Let me know if you have any other questions or comments.
P.P.S. I volunteer my time at AllExperts to help people, and I get a LOT of questions, so I can't take an hour to answer each question. If you need more DETAILED HELP, come to my TechHelp web site at http://www.599cd.com/TechHelp/AllExperts and I'll take as much time as you need to answer your question.