time date button

G

Guest

I tutor students in a 1:1 setting online. I wish to track the amount of time
I teach the student in each class. Sometimes there are housekeeping issues
that need to be address before we begin the actual teaching.

So one student will have many classes. There is only one student in each
class.

I have among other the tables, two tables tblstud and tblclassnotes. In the
tblclassnotes, there are two fields [TeaStart] and [TeaFin]

I made a form (frmClassnotes) with a subform (sbfclassnotes) using fields
from tblstud and tblclassnotes. The fields [TeaStart] and [TeaFin] are in the
subform

I have been entering the date and time manually. I wish to have this time
entered via a command button. I want to click the button that will enter the
time we start and the click another buttom to enter the time we finish. I
have looked at the posts regarding date/time stamps. In doing so I came
across some code:

Me!TeaStart = Now() which I have entered in the command button (on click
event) on the subform. In the form view I click on this button and nothing
happens. I am hoping that the TeaStart field would be filled.

Any help and suggestions would be appreciated. Thanks in advance.
 
P

Pat Hartman \(MVP\)

the form needs to be bound to the tblclassnotes table. If you use the Dot
syntax -- Me.TeaStart -- you will get intellisense after you type the dot.
If TeaStart doesn't show up in the list, it is not part of the form's
RecordSource.
 
G

Guest

Ok, I should have explained better. Either that or I don't know what you mean
exactly. Probably both. I used form wizard to make the form frmClassnotes. I
used fields from tblstud and tblclassnotes (including the fields [TeaStart]
and [TeaFin]) It took the fields from tblstud and put them in the main form
and put the fields from tblclassnotes in the subform. If I make a form based
solely on the tblclassnotes table, the only way I can identify the students
is by an id number which be very difficult as there are over 75 students.
 
B

BruceM

You should be able to use the combo box wizard to find the student by name.
Choose the option to Find a record based on the combo box selection (or
something to that effect). What happens there is that the combo box list is
based on tblStudent (or a query based on tblStudent). The bound column in
the combo box, is the StudentID, but the visible columns are the name. By
choosing a name you are really choosing the associated ID number.
However, I wonder if it is necessary. I have not used the wizard lately to
make a form, but can you change the default view of the subform to
Continuous? That way you could go to the Student record and see all of that
Student's ClassNotes in a continuous list.
 
G

Guest

Thanks for your help,

I did try your suggestions but they didn't work out so well. It could be my
novice ability when it comes to Access 2007. As a far a continious form, it
didn't work as there are some students I teach / tutor daily. So I really
don't want 30,60,90 etc listings of class notes. Again I apprecaited your
help. I was just hoping there was some way to enter current date and time
into a field in a subform by pushing a button.

Thanks again. I really enjoy these form and have received valuable
information.
Keep up the great work.
--
I was laying in bed the other night, looking up at the stars, and
thinking...Where in the heck is my roof?


BruceM said:
You should be able to use the combo box wizard to find the student by name.
Choose the option to Find a record based on the combo box selection (or
something to that effect). What happens there is that the combo box list is
based on tblStudent (or a query based on tblStudent). The bound column in
the combo box, is the StudentID, but the visible columns are the name. By
choosing a name you are really choosing the associated ID number.
However, I wonder if it is necessary. I have not used the wizard lately to
make a form, but can you change the default view of the subform to
Continuous? That way you could go to the Student record and see all of that
Student's ClassNotes in a continuous list.

RoK2774 said:
Ok, I should have explained better. Either that or I don't know what you
mean
exactly. Probably both. I used form wizard to make the form
frmClassnotes. I
used fields from tblstud and tblclassnotes (including the fields
[TeaStart]
and [TeaFin]) It took the fields from tblstud and put them in the main
form
and put the fields from tblclassnotes in the subform. If I make a form
based
solely on the tblclassnotes table, the only way I can identify the
students
is by an id number which be very difficult as there are over 75 students.
 
J

John W. Vinson

I did try your suggestions but they didn't work out so well. It could be my
novice ability when it comes to Access 2007. As a far a continious form, it
didn't work as there are some students I teach / tutor daily. So I really
don't want 30,60,90 etc listings of class notes. Again I apprecaited your
help. I was just hoping there was some way to enter current date and time
into a field in a subform by pushing a button.

Simplest might be to put code into the textbox's DoubleClick event:

Private Sub txtTime_DoubleClick(Cancel as Integer)
Me.txtTime = Now
End Sub

No button, one line of code, easy to use (once the user understands
that just doubleclicking a date field will fill in the current date &
time).


John W. Vinson [MVP]
 
G

Guest

I think it's a brilliant idea. I do need some help in getting it to work.
Sorry.

I entered the code exactly as you type it didn't worked. I double clicked
and nothing appears to happened. I assumed I would have to change it, but
wasn't sure. I changed it to

Private Sub TeaStart_DblClick(Cancel As Integer)
Me.TeaStart = Now
End Sub

and

Private Sub TeaStart_DblClick(Cancel As Integer)
Me.TeaStart = Now ()
End Sub


as TeaStart is the name of the field in the table tblClassNotes.

still nothing appears to happen...

Thanks for trying to help . Anything ideas are appreciated.
 
J

John W. Vinson

I entered the code exactly as you type it didn't worked. I double clicked
and nothing appears to happened. I assumed I would have to change it, but
wasn't sure. I changed it to

Private Sub TeaStart_DblClick(Cancel As Integer)
Me.TeaStart = Now
End Sub

and

Private Sub TeaStart_DblClick(Cancel As Integer)
Me.TeaStart = Now ()
End Sub


as TeaStart is the name of the field in the table tblClassNotes.

still nothing appears to happen...

Thanks for trying to help . Anything ideas are appreciated.

The name of the field in the table is not what you need; you need
instead the name of the form control.

This may be TeaStart, I don't know.

I'd suggest deleting this control from your form and this Sub from the
form's module, and choosing Tools... Database Utilities... Compact
and Repair, just in case your fiddling around has left some invalid
code. Then use the field list to add TeaStart to the form again. I'd
suggest changing the Name property of the textbox from TeaStart to
txtTeaStart (the problem may be because Access can't decide whether
you mean the field or the control!)

Select the Events tab of the textbox properties; click the ... icon by
the Double Click event; select Code Builder. Access will give you the
Sub and End Sub lines.

Between them insert

Me.txtTeaStart = Now

If you use Now(), Access will just discard the parentheses, so don't
bother!

Then choose Debug... Compile <your database>; then click the diskette
icon to save the project.

This *should* now fill in the current time when you doubleclick.

John W. Vinson [MVP]
 

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

Top