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 May 14th, 2004, 05:20 PM
Registered User
 
Join Date: May 2004
Location: kingsport, t, .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default update query?

I am a beginner to access so be explicit please.
I have a problem tring to create a updatequery using a function that I have written. the function looks like this
public function total (shiftstart as date, shiftend as date) as single
if shiftstart > 0 then
    total = datediff("n", shifstart) - datediff("n", shift end)
elseif shiftstart = 0 then
    total = 0
end if
when i try to use this in an update query I get an error stating that I have an operand or operator error??
Any suggestions would be appreicated
  #2 (permalink)  
Old May 14th, 2004, 08:31 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

For this: datediff("n", shift end)

there's a space in "shift end" where there shouldn't be. Is that a typo, or is that in your code?

Brian
  #3 (permalink)  
Old May 15th, 2004, 11:00 AM
Registered User
 
Join Date: May 2004
Location: kingsport, t, .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

typo on my part

  #4 (permalink)  
Old May 18th, 2004, 11:46 PM
Authorized User
 
Join Date: May 2004
Location: , NH, USA.
Posts: 52
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Your original
Quote:
quote:total = datediff("n", shifstart) - datediff("n", shift end)
is using the wrong syntax for DateDiff.

Try this:
Quote:
quote:total = datediff("n", shifstart, shiftend)
  #5 (permalink)  
Old May 19th, 2004, 04:41 PM
Registered User
 
Join Date: May 2004
Location: kingsport, t, .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks man
Quote:
quote:Originally posted by Bob Hansen
 Your original
Quote:
quote:total = datediff("n", shifstart) - datediff("n", shift end)
is using the wrong syntax for DateDiff.

Try this:
Quote:
quote:total = datediff("n", shifstart, shiftend)


Similar Threads
Thread Thread Starter Forum Replies Last Post
Update Query Help dalezjc Classic ASP Basics 8 March 18th, 2008 08:49 AM
I solved insert query.now see this Update Query. amit_mande@yahoo.com VB.NET 2002/2003 Basics 2 September 21st, 2006 12:48 AM
Update query trab Access 1 May 11th, 2006 03:58 PM
Please Help me about UPDATE query huyremy VB Databases Basics 8 September 29th, 2004 03:45 AM
Update query edcaru Access 3 June 14th, 2004 03:04 AM





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