help editing data

G

Guest

I have a table containing records regarding time spent on specific projects.
with the following fields:

tblTime
---------
TimeID (PK)
EmployeeID (From tblEmployees)
ProjectID (FromtblProjects)
DateIn
TimeIn
DateOut
TimeOut

The first form I have creates a record. the user selects his EmployeeID and
the projectID. The DateIn and TimeIn are set to DAte() and Time(). so when
the form is closed a new record is created containg the data of who and which
project and the time the record was created.

I now need a second form where the user can select the record desired and
the dateOut and TimeOut fields are completed. So far I have a Form where the
employee selects his number(from a combo) and the date the job was started.
Then I have a combo which has options selected from a query which uses the
data from the first two form boxes. this allows the user to choose any
records that match their EmployeeID, DateIn and have no value for DateOut.
This so far is fine.

However how do i go about then entering the current time and date into the
TimOut and DateOut fields for the chosen record? At the moment I have text
boxes wth their default value set to Date() andTime(). I assumed that if i
then just put their RecordSource to the relevant field that when the form was
closed these values would be put into the desired record. However there seems
to be nothing happening whatsoever.

any help would be greatly appreciated.

regards James
 
S

Svetlana

Its needed something to change on your form for update and just a
default value cant make it. I think if you want to make it in an
"automatic" way then you could use the after update event of the
combobox to pass the values you wish so to fire up the dirty event of
your form. Then in the before update event of your form you could ask
the user if he wants to save the data or not.
 
G

Guest

James,

I suggest you add a command button to the form to set the out fields,
however, you can simplify your fields since the Date/Time data type stores
both the date and the time. You can set it to the current date and time with
the assignment expression:

=Now()

You can always use the DatePart or Format functions to display portions of
this field on your form or in reports.

The command button code, with a single LogOut field would be:

Me![LogOut] = Now()

Hope that helps.
Sprinks
 

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

Similar Threads

Time Date Query 1
DateAdd & DateDiff Problems 1
#Name? - Killing Me 4
Dlookup error 13 7
time difference 1
Set value in one field based on selection from lookup field 7
DateDiff past Midnight 8
Comparing dates 11

Top