Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old December 30th, 2006, 09:07 AM
Authorized User
 
Join Date: Dec 2003
Location: Vashi, Navi Mumbai, Maharashtra, India.
Posts: 63
Thanks: 0
Thanked 0 Times in 0 Posts
Default Form Activate help

Hi all members
I wrote a DOR(Date of Retirement) function now my problems is I create a form(frmEmp) it is related my table(tblEmp) in that table there are Emp_No.,Emp_Name,Emp_Dob(date field), Emp_Dor Emp_dor is unbound field in my form I call my above function in Emp_dor Now I want to append to Emp_dor function date into my table field Emp_dor how should I write the code in form Form_Activate() event please help me


Mohamed Mohiddin
Officer
__________________
Mohamed Mohiddin
Officer
  #2 (permalink)  
Old January 3rd, 2007, 03:51 PM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

The Emp_Dor text field on the form must be bound to the Emp_Dor field in the table. Is there a reason you didn't do this?

Put the function call on the On Current Event of the form.
I suppose you take a date and pass it to the function to calculate the date of retirement. If so, then do something like this on the On Current Event:

Dim dtDOB as Date

dtDOB = Me.Emp_Dob

Me.Emp_Dor = DORFunction(dtDOB)

If you don't want to do that, then just put the function code in the On Current event of the form and use the Me.Emp_Dor line to post the results.

You should also put this on the Before Update and Before Insert events so that the Dor will be pushed each time you create a record and update a record. Then you probably won't need it on the On Current event.

HTH

mmcdonal
  #3 (permalink)  
Old January 5th, 2007, 12:35 PM
Authorized User
 
Join Date: Dec 2003
Location: Vashi, Navi Mumbai, Maharashtra, India.
Posts: 63
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for your replies! I was really happy I salve my problem


Mohamed Mohiddin
Officer


Similar Threads
Thread Thread Starter Forum Replies Last Post
Activate the current window Probleminfinity Excel VBA 1 August 29th, 2007 04:44 PM
activate sheet mike0123m Excel VBA 1 August 11th, 2007 01:19 PM
multipage activate Fat_and_immoral Excel VBA 5 March 7th, 2007 02:03 PM
Activate or Deactivate controls on forms chacquard Access VBA 3 November 27th, 2006 08:03 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.