MS Access UPDATE not updating with cfquery

Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default MS Access UPDATE not updating with cfquery

    Three columns will update (GolaCalls, GoalContacts, and GoalAppts). However,
    the two columns FirstName and LastName remain unchanged even if there is a
    change to the field #form.FirstName# or #form.LastName#.
    I get no error messages and if I hardcode #form.FirstName# to something like,
    FROG, then it works. The variable is being passed as I have it print out for
    verification.

    Any ideas why FirstName and LastName will not update?

    CODE:
    <cfquery datasource="scorecarddb" username="####" password="####"
    name="uploadrep">
    UPDATE #tblName#
    SET FirstName = '#form.FirstName#', LastName = '#form.LastName#', GoalCalls =
    '#form.GoalCalls#', GoalContacts = '#form.GoalContacts#', GoalAppts =
    '#form.GoalAppts#'
    WHERE ((LastName = '#form.LastName#') AND (FirstName = '#form.FirstName#'));
    </cfquery>

    adotfilm Guest

  2. Similar Questions and Discussions

    1. Cfquery Update Syntax Suddenly bad???
      The following code has been working for 2yrs or so; And suddenly I get the following error; Error Executing Database Query. Syntax error in...
    2. Results of update in CFQUERY
      And what about delete? Seems like delete does not return anything neither.
    3. Error executing a cfquery update statement. PLEASE HELP
      I have been over and over this. I am trying to update a simple table. I took this script from the same server using a different DSN. I keep...
    4. update query not updating
      Hi I am trying to update via an datagrid only nothing seems to happen how would I diplay what the update query looks like msgbox reponse.write?...
    5. Update not updating :(
      Hi guys, Still having problems with updating my mysql database records. I can now enter the data i want to update but, when I check the database...
  3. #2

    Default Re: MS Access UPDATE not updating with cfquery

    Look at your where clause. You are saying change the names if they are equal the new values.

    What is the primary key of your tblName table?
    Dan Bracuk Guest

  4. #3

    Default Re: MS Access UPDATE not updating with cfquery

    OK, good point. So I'm trying the WHERE clause with the primary key 'ID',
    having this field passed into the query from a hidden field--BUT--it still
    isn't working.

    UPDATE #tblName#
    SET FirstName = '#form.FirstName#', LastName = '#form.LastName#', GoalCalls =
    '#form.GoalCalls#', GoalContacts = '#form.GoalContacts#', GoalAppts =
    '#form.GoalAppts#'
    WHERE ID = '#form.ID#';


    adotfilm Guest

  5. #4

    Default Re: MS Access UPDATE not updating with cfquery

    Take the quotes away from any numeric fields. ID is probably one of them.
    Dan Bracuk Guest

  6. #5

    Default Re: MS Access UPDATE not updating with cfquery

    Thank you for your help. I created another column to use as an unique numeric ID for each person and referenced that. Couldn't make the Primary Key work for some reason. Thanks again.
    adotfilm Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139