CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8

Thread: GETDATE()

  1. #1
    Join Date
    May 2001
    Location
    MO, USA
    Posts
    87

    GETDATE()

    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


  2. #2
    Join Date
    Aug 2001
    Posts
    14

    Re: GETDATE()

    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).


  3. #3
    Join Date
    May 2001
    Location
    MO, USA
    Posts
    87

    Re: GETDATE()

    well picky this is VB 6.0 not c++ so no header or main to plac it in....

    thanks anyway

    midnightservice


  4. #4
    Join Date
    Aug 2000
    Location
    Namibia
    Posts
    139

    Re: GETDATE()

    Hi, if this query in VB then use the 'now()' function.


  5. #5
    Join Date
    May 2001
    Location
    MO, USA
    Posts
    87

    Re: GETDATE()

    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


  6. #6
    Join Date
    Apr 2000
    Posts
    69

    Re: GETDATE()

    Why don't you try DateDiff()function.

    Eddie


  7. #7
    Join Date
    May 2001
    Location
    MO, USA
    Posts
    87

    Re: GETDATE()

    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


  8. #8
    Join Date
    Aug 2000
    Location
    Namibia
    Posts
    139

    Form_QueryUnload Event

    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.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured