Insert date using one click buttons

  • Thread starter Thread starter Teresa via AccessMonster.com
  • Start date Start date
T

Teresa via AccessMonster.com

I have created a database to record student attendances. Classes occur on
every day of the week and the database is normally update once per week.
There are hundreds of attendances to add so I'm looking for a

I have an idea of what I want to achieve but, being a novice user, I have
no idea how to achieve it....

I've figured out a way to easily select the student I want and have created
a sub form with that student's attendance details.

Now I want to be able to create a new attendance record and populate a
particular field in the record with a date with a single click of one of
seven buttons marked monday through sunday. I envisage that the date
allocated to each button would be calculated by prompting the user for a
week ending date on opening the database, i.e. it would be set once at the
beginning of each session. (It would also be good to display the week
ending date in the input form).
 
Teresa,

You could put a textbox on the Form Header of the main form, where the
user can enter the Week Ending date. Assuming this is a Sunday, your 7
buttons would use code like this...

Private Sub MondayButton_Click()
Me.ClassDate = Me.WeekEnding - 6
End Sub

Private Sub TuesdayButton_Click()
Me.ClassDate = Me.WeekEnding - 5
End Sub

Etc...

Just a comment on style... Assuming this is a continuous view subform,
you will need to put your set of 7 buttons in the Detail swection, and
they will show foer every record. You are going to have a lot of
command buttons on your form! So, I'd just thought I'd make sure you
know that direct data entry of dates in Access can oftem be done very
quickly and efficiently. For example, Access will assume the current
year, which would be the case with all your data. So all you would need
is to type in 3/5 (or 5/3 depending which country you are in) to enter
today's date. I suspect many users would find this just as easy as
reaching for the mouse to click on a Tuesday button selected from a bank
of buttons. Just a thought. Also, Access has a keyboard shortcut
Ctrl+; to enter the current date, which may be applicable at times.
Also, you are entering the class attendance for each student. In such
scenarios, it would often turn out to be simpler to enter the student
attendance for each class, if you set up your subforms appropriately.
The same data ends up in the database, but the data entry process is
less repetitive. Hope these comments are useful.
 
Thanks Steve that's a useful start. Unfortunately the person who will be
entering the data is very keen on doing everything with mouse clicks and
hey! it's a challenge!

As for the button solution...
Do you mean put an unbound text box on the subform?
I tried this and put the button and the textbox in the header of the
subform and used docmd to create a new record before populating it with the
attendance date. This is all fine except I lose the week ending date each
time I exit the form (i.e. each time I select another student). Also, if I
put the text box on the main form, using Me! to refer to it doesn't work.

How do I enter the date so that it is saved for the whole session and how
do I refer to it?
 
Teresa,

I meant to put the unbound textbox in the Header of the main form. When
you have entered the date in here, this value should be retained in the
textbox when you navigte to other records. You can refer to it from the
subform, in code or expressions like this...
Me.Parent!NameOfTextbox
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top