AllExperts > Using MS Access 
Search      
Using MS Access
Volunteer
Answers to thousands of questions
 Home · More Using MS Access Questions · Answer Library  · Encyclopedia ·
More Using MS Access Answers
Question Library

Ask a question about Using MS Access
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Richard 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.

Experience
I am the president of AccessLearningZone.com and 599CD.com. I specialize in Microsoft Access Tutorials. I have been teaching Access in the classroom since 1994, and online since 2002.

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

 
   

You are here:  Experts > Computing/Technology > Business Software > Using MS Access > Updateing table field when a macro is run

Using MS Access - Updateing table field when a macro is run


Expert: Richard Rost - 7/9/2009

Question
Hello,

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.

Also, be sure to visit my web site and watch my FREE 90-minute MICROSOFT ACCESS VIDEO TUTORIAL. Go to http://www.599cd.com/Access/AllExperts


Cordially,

Richard Rost
599CD Computer Training
http://www.599cd.com

P.S. Also, don't forget to visit my FREE Microsoft Access Tips & Tricks Page at http://www.599cd.com/Tips/AllExperts

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.

http://www.599cd.com/Microsoft_Access_Tutorial?key=AllExperts

Out of work? Know someone who is? Get a FREE copy of my Computer Job Skills CD at http://www.599cd.com/JobSkills?key=AllExperts

Add to this Answer   Ask a Question


 
User Agreement | Privacy Policy | Kids' Privacy Policy | Help
Copyright  © 2008 About, Inc. AllExperts, AllExperts.com, and About.com are registered trademarks of About, Inc. All rights reserved.