Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

updating a date field in table from a form -with sysdate

Status
Not open for further replies.
Jul 15, 2003
10
GB
I am no expert in access so I need some help with the above.
I have developed a form for outbound telesales. This form is polulated by means of a query which queries a table -based on whether a phone Num exists and call outcome is not populated.
What I am trying to do is to datestamp a field in the table called date_ofcall with the date the call took place when the operator has completed the call and moves to the next record.
All other elements are updated back to the table correctly from the form- once the call has been completed and next record selected
I have tried two approaches - setting up an event procedure before_update called date of call - see below:
version1
Private Sub dateofcall_BeforeUpdate()
Dim callback_date
Set callback_date = date
End Sub

I then tried to use a Macro to populate the date on next rec
using the date() function as follows:
IsNull([Date_ofcall]) --> go to control source
... ---> RunCode
This Macro is run when the next record command box is selected. Otehr elements of the macro work but the date part doesn't

I have also setting the update of table containing the date_ofcall field to date() and this doesn't work either nor does the time update .
'RS!Date_OfCall = Forms!callsmade2!date_ofcall
'RS!TimeOfCall = Time ()
I have checked that the control source in the from is updating the correct field in the table (see above).

I have scoured previous threads to find similar problems but could'nt find (maybe understand )a solution that would work for me.

Please try to make the responses idiot proof as I am not vb prodicient.

Also how can I implement record locking on the form so that all operators are not accessing the same records?
Thanks

 
1. The simplest way is to do this on the form level, under the BeforeUpdate event of the form

Me.callback_date = Date

Make sure callback_date is the name of the field on the form for your date/time stamp, I would make this field invisible so users not to put date in themselves.


2.To deploy record locking, in Access 2000 or above (if you are using Access 97, you are out of luck).
a. Make sure the form’s Record Locks set to Edited Record (under Data tab).
b. On Access Menu, click Tools, Options, under Advanced tab, make sure “Edited record” is selected for default record locking.

You are off to a true record locking the way you want. Your ranking in dealing with Access is one knot above novice. Congratulations!
 
Home alone,
Many thanks for your help - it worked like a dream.
Unfortunately on the record locking scenario it's 97 we're using.
Cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top