Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Mar 2006
    Posts
    195
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Too few parameters (Access 2000)

    When i am updating wth 0.3 my function works without problems:
    CurrentDb.Execute "UPDATE Products SET DDU = DDU + 0.3"
    However, when i try to insert a constant as
    Public Const MyRate As Double = 0.3
    and replace it as:
    CurrentDb.Execute "UPDATE Products SET DDU = DDU + MyRate"

    Then i get the messahe tto few parameters.Why is it so ?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Too few parameters (Access 2000)

    Because SQL doesn't know about VBA constants and variables. You must put the constant outside the quotes and concatenate it with the SQL string:

    CurrentDb.Execute "UPDATE Products SET DDU = DDU + " & MyRate

  3. #3
    2 Star Lounger
    Join Date
    Mar 2006
    Posts
    195
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Too few parameters (Access 2000)

    Thank you, Hans !

Posting Permissions

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