Update form

N

nancy

I am creating a sign-in and a sign-out foms for volunteers to use.
I would like to I have figured out how to automattically add the current
time to the
StartDateTime field base on selecting a name from a drop down list.

I have created a new form where I would like for it to add the EndDateTime
to the Name selected based on curent date.


This is what I would like it to do.
On change of Namelist Select the record from volhrstbl where voldate = today()

I would like to show the StareDateTime

I probably don't have to use to different form if I knew how to program the
button better.

Please help
 
N

nancy

Let me see if i could explain this better.

I am having volunteers sign in and sign out on the same day.

I am using a form that is linked to a table.
the Column on the table are ID, Namelist (look-up from a different table),
VolDate, startdatetime, endstardate time.

I have on form that signs them in. It works great. It adds the current
time and date to the persons name.

Now I want the volunteer to sign-out.
I want them to choose their name based off of a combo box.
Now I want them to click a button. Upon clicking a button, the current time
i(enddatetime) is added to the person sign-in information based on todays
date.

I will try to give a visual on this

Sign-in
Choose name. Click sign-in button
ID: 1 NameList: Doe, John Voldate: 6/29/2009 Startdatetime: 1:15
pm Enddatetime:


Sign-out: Choose name. Click sign-out button.
ID: 1 NameList: Doe, John Voldate: 6/29/2009 Startdatetime: 1:15
pm Enddatetime: 3:15 pm


I hope I better explained what I want.
Thans for helping
 
N

nancy

That is getting closer. But I can't get the program to run.
In the property sheet for the button Called signout CMD, I went to the Event
tab.
Click the three dots and chose code builder.
I placed it in the Microsoft Visual Basic window.
I saved it and the went to my form and clicked the button. Nothing happened.

I was also thinking how I would prevent people signing out on the wrong name.
From the little SQL scripting I know I would like it to Select the
EndDateTime and StartDateTime from my table call Volhrstbl, based on the
name selected from the Namelist and today's date. If someone choose a name
that has not sign-in then a message box appears stating that the person
selected has not signed in otherwise enter current time


DoCmd.RunSQL "SELECT EndDateTime, StartDateTime FROM Volhrstbl WHERE
Namelist = " & Namelist & " and voldate = Date();"
If StartDateTime Is Not Null Then DoCmd.RunSQL "Update Volhrstbl Set
EndDateTime=Time() Where [Namelist]=" & Namelist & " And voldate"
Else: MsgBox "The name selected has already signed in."

I hope this would work

Nancy






ErezM via AccessMonster.com said:
hello again
in the singout button's click:

DoCmd.RunSql "Update tblTimeRecording Set SignOutTime=Now() Where NameList='"
& ComboBoxWithNames & "' And VolDate=Date();"

which in eglish means: find a record in the table that has the selected
combobox name and date is today, and set that record's end-time to now.

mind that a user can signout many times over and over and re-set the time

i hope thats closer to what you wanted

Erez
Let me see if i could explain this better.

I am having volunteers sign in and sign out on the same day.

I am using a form that is linked to a table.
the Column on the table are ID, Namelist (look-up from a different table),
VolDate, startdatetime, endstardate time.

I have on form that signs them in. It works great. It adds the current
time and date to the persons name.

Now I want the volunteer to sign-out.
I want them to choose their name based off of a combo box.
Now I want them to click a button. Upon clicking a button, the current time
i(enddatetime) is added to the person sign-in information based on todays
date.

I will try to give a visual on this

Sign-in
Choose name. Click sign-in button
ID: 1 NameList: Doe, John Voldate: 6/29/2009 Startdatetime: 1:15
pm Enddatetime:

Sign-out: Choose name. Click sign-out button.
ID: 1 NameList: Doe, John Voldate: 6/29/2009 Startdatetime: 1:15
pm Enddatetime: 3:15 pm

I hope I better explained what I want.
Thans for helping
hi
i didnt really understood what you wrote, but anyway:
[quoted text clipped - 26 lines]
Please help
 
N

nancy

Thank you ver much. can you send it to my e-mail address at
(e-mail address removed)? You're a lifesaver.

Blessing to you

ErezM via AccessMonster.com said:
i built a small mdb file to demostrate the sign in and out procedures with
all check-ups and conditions, but then found out i cant attach a file to my
posts
if you have an alternative, the file is ready for you (270KB)

That is getting closer. But I can't get the program to run.
In the property sheet for the button Called signout CMD, I went to the Event
tab.
Click the three dots and chose code builder.
I placed it in the Microsoft Visual Basic window.
I saved it and the went to my form and clicked the button. Nothing happened.

I was also thinking how I would prevent people signing out on the wrong name.
From the little SQL scripting I know I would like it to Select the
EndDateTime and StartDateTime from my table call Volhrstbl, based on the
name selected from the Namelist and today's date. If someone choose a name
that has not sign-in then a message box appears stating that the person
selected has not signed in otherwise enter current time

DoCmd.RunSQL "SELECT EndDateTime, StartDateTime FROM Volhrstbl WHERE
Namelist = " & Namelist & " and voldate = Date();"
If StartDateTime Is Not Null Then DoCmd.RunSQL "Update Volhrstbl Set
EndDateTime=Time() Where [Namelist]=" & Namelist & " And voldate"
Else: MsgBox "The name selected has already signed in."

I hope this would work

Nancy
hello again
in the singout button's click:
[quoted text clipped - 47 lines]
Please help
 

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

Calculating Time 2
Forms with ADP 9
Sum of Time Difference 2
details record on the form 2
Open a From based on Criteria 3
DateDiff Problems 4
Comparing data from a subform and form 1
Time Calculation 5

Top