Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access 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 September 5th, 2006, 02:55 AM
Friend of Wrox
 
Join Date: Dec 2005
Location: CHENNAI, TAMILNADU, India.
Posts: 233
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to anukagni Send a message via Yahoo to anukagni
Default Table & From link

he guys,

 I nave create an table with DATE OF CALL BOOKED & DATE OF CALL COMPLETED AND NO OF DAY'S taken and in the from i play the source data of the No of day's taken as =[DATE OF CALL BOOKED] - [DATE OF CALL COMPLETED]...

  It's working in the from but it is no storing in the table what is the reason for the above issue..and how can i store the data in the table ...

 Give me some codes..
 or
 exaples for this

 This is the long term Question for me...

Learn as you can..
------------------------
pap...
  #2 (permalink)  
Old September 5th, 2006, 07:02 AM
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

Hi,

   In the After Update, or Before Insert event of the second field, put this code:

Dim dtCallBooked As Date
Dim dtCallComplete As Date
Dim iDays As Integer

dtCallBooked = Me.Date_of_Call_Booked ' never use spaces in field names - Access will insert underscores in control names.

dtCallComplete = Me.Date_of_Call_Completed

iDays = DateDiff(dtCallComplete - dtCallBooked) 'I think that is right, or reverse the order

Me.No_of_Days = iDays

That should work. Let me know if it doesn't.



mmcdonal
  #3 (permalink)  
Old September 8th, 2006, 12:50 AM
Friend of Wrox
 
Join Date: Dec 2005
Location: CHENNAI, TAMILNADU, India.
Posts: 233
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to anukagni Send a message via Yahoo to anukagni
Default


Mc.. its not working

 I have stored in the from's after update but i doesnt works..
 what to do..



Learn as you can..
------------------------
pap...
  #4 (permalink)  
Old September 8th, 2006, 01:45 AM
Friend of Wrox
 
Join Date: Dec 2005
Location: CHENNAI, TAMILNADU, India.
Posts: 233
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to anukagni Send a message via Yahoo to anukagni
Default

Hi mc

I got the code.. this is wat i stated...

In the from.. before insert event i enter this code as what u said

Dim dtCallBooked As Date
Dim dtCallComplete As Date
Dim iDays As Integer

dtCallBooked = Me.Date_of_Call_Reported

dtCallComplete = Me.Date_of_Call_Completed

iDays = DateDiff(dtCallComplete - dtCallBooked)

Me.No_of_day_s = iDays.. i quit hard to uderstand..

then i tried this code with som altration in Data of completion get focus event

Dim dtCallBooked As Date
Dim dtCallComplete As Date
Dim iDays As Integer

If IsNull(Me.Date_of__Call_Completed.Value) = False And IsNull(Me.Date_of_Call_Reported.Value) = False Then
dtCallBooked = Me.Date_of_Call_Reported.Value
dtCallComplete = Me.Date_of__Call_Completed.Value
iDays = DateDiff("d", dtCallBooked, dtCallComplete)
Me.No_of_day_s.Value = iDays
End If

it works .. thanks for ur kind support donal



Learn as you can..
------------------------
pap...


Similar Threads
Thread Thread Starter Forum Replies Last Post
Populate a List Box with Table Names & Table date hewstone999 Access VBA 1 February 27th, 2008 10:10 AM
link report & subreport bib BOOK: Beginning Visual Basic 2005 ISBN: 978-0-7645-7401-6 1 November 22nd, 2007 01:42 AM
Excel 2007 & Access Database Link KennethMungwira Excel VBA 0 October 22nd, 2007 08:26 AM
Simple subselect & image link ymoisan Excel VBA 0 May 4th, 2004 10:04 AM
sql & join tables & find a field in multiple table trangd Beginning PHP 2 January 29th, 2004 07:18 PM





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