Consulting

Results 1 to 5 of 5

Thread: Ghost parameter in Update Query

  1. #1
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,443
    Location

    Ghost parameter in Update Query

    I am sure I am missing the obvious, but here goes anyway.

    I have written hundreds of parameterised queries in Access, but I don't recall having this problem before. The following update that should prompt for 3 values prompts for4, an extra value.

    UPDATE Product 
    SET ProductName = param.product, ProductType = param.product.type
    WHERE Id = param.id;
    As well as the 3 parameters that I have setup, it also prompts for ProductType. What am I missing here?
    Last edited by Bob Phillips; 03-05-2022 at 11:45 AM.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  2. #2
    do you have ProductType fieldname.
    make sure your Spelling is correct against the actual fieldname.

  3. #3
    do you have ProductType fieldname.
    make sure your Spelling is correct against the actual fieldname.
    even if you supply the parameter
    ProductType with any value, the query will fail because
    it will not find the field.

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,443
    Location
    My first thought when I saw your response was that I have been doing this for decades, do you think I am an idiot. But it turns out I am an idiot. That was exactly the problem, I had renamed ProductType to ProductTypeId (it is a foreign key). My only defence mitigation is that, when looking at the table in Datasheet view, it doesn't show the Id part in the header name, but then, I should have been looking in design view.

    Thanks for spurring me to take off the blinkers.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  5. #5
    Moderator VBAX Guru Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    4,997
    Location
    Off with his head...
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

Posting Permissions

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