Click to See Complete Forum and Search --> : GETDATE()


midnightservice
September 2nd, 2001, 07:33 PM
i have a database program and i need to print a query when a certain time lasp has accurd in a date length...
i creadted a search query and in the required field i put in the criteria of


from (orderdate >= DATEADD(day, -5, GAETDATE()))

when i run the query i get and error
undefined function 'getdate' in expression

also after i create this and get it working how do you run a query from a command button..

midnightservice


thanx in advance

Picky
September 2nd, 2001, 07:39 PM
Did you include the header for it? Or did you place a prototype for the function GETDATE() (or put the function above the main() function) above main()?

That's all I think of (and if you made GETDATE(), make sure you add the .cpp file to the Project).

midnightservice
September 2nd, 2001, 07:48 PM
well picky this is VB 6.0 not c++ so no header or main to plac it in....

thanks anyway

midnightservice

phunkydude
September 3rd, 2001, 11:06 AM
Hi, if this query in VB then use the 'now()' function.

midnightservice
September 3rd, 2001, 12:27 PM
okay i used the now() function like this
<={fn NOW()}
but it istll will not go back 5 days...it will generate a report for the day before this and back but i wont it to start 5 days before the current date..

midnightservice

Eddie Leong
September 3rd, 2001, 12:57 PM
Why don't you try DateDiff()function.

Eddie

midnightservice
September 3rd, 2001, 12:59 PM
okay i got it ty......new function

<={fn NOW()-5}
okay now i have one more question i made a 2 querys...
1. insert query
2. delete query
to move info from one table to another
how do i execute the querys....i have tried to load them from the load and excute commands but what i want is when they close a form the queery is automatically ran and completed and then the program shuts off... any ideas....

midnightservice

phunkydude
September 4th, 2001, 04:17 AM
I don't quite know what you mean, but the QueryUnload event may do the trick. It gets run before the Form_Unload event and would probably be the most suitable place for the code to run the action queries you want.

HTH ... if I'm off the point mail me your requirement, I'll try have a look.