UPDATE using a query?

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

  1. #1

    Default UPDATE using a query?

    I thought something would be easy, but I'm lost. Quickly, I'm making a form to
    sign up employees for a training course. The selection is 1 of 4 dates, then a
    box for completed (Y/N). First trying to update dates. I read the employee name
    (Access primary key) and have a string field for date. I am able to fill out
    the form with the current date picked (radio buttons for now). I need to be
    able to edit the dates chosen and then, I imagine, use SQL UPDATE to write the
    data back to the table. But, the employees come out of an Acces table, and I
    get lost trying to assign the NAME field in the <CFINPUT> tag. If I assign them
    the same name for each record, then all date fields on the screen are a single
    NAME. Clicking the radio button for different employees turns off all other
    fields. Makes sense. So I tried using the Access table field for employee name
    as the NAME field, such as: <cfinput type='radio' name='#strLotusID#'
    value='05/13/2005' checked='#checked#'> Thus, every record displayed is
    different, so that works for displaying the current data. But, when I submit
    the form, I don't know how to construct my UPDATE statement. I would be happy
    just to use the CFQUERY tag to go through all employees and update the date
    field with the new date (even if it wasn't changed). Using the employee name
    as the key, I tried this update: <cfquery datasource='Safety' name='updating'>
    UPDATE tbl.CPR SET strDATE = '#form.strLotusID#' </cfquery> First of
    all, are all the date fields passed to the Action file from the form at all? Or
    can you only update 1 record at a time (I didn't think so). Or do I have to
    fill up an Array with the data to write and then feed that in a loop to UPDATE?
    Or do I have to create a new field, and ID number, in the employee table and
    and use that in the WHERE clause? Does anyone see what I'm trying to do? I
    feel it might not be clear unless you are trying this yourself! Thanks, Howard
    Perlman US Geological Survey [email]hperlman@usgs.gov[/email] The logic of this seems wrong.
    I was hoping I

    Howard Perlman Guest

  2. Similar Questions and Discussions

    1. Looping an update query
      Hello Everyone, I would like to change the rank of some items. So i got a table tbl_rank with: ID, item, rank (rank: 1,2,3,4,5,...) The way i...
    2. Update Query.. asp/access db
      Hi, Does anybody know what this error is about? ____ Microsoft OLE DB Provider for ODBC Drivers error '80004005' Operation must use an...
    3. SQL Update Query Error
      can someone tell me what is wrong with this query? I've tried every combo that I can think of - adding &,"", "'", ) everywhere I can think of and I...
    4. Update query help
      I'd like to update some of the fields in a table 'master', where some of the data in a row already exists. For example, I'd like to add to a record...
    5. Append & Update Query???
      Before the queries are run, set SetWarnings False, then SetWarnings True after you've run. BTW, it's possible to do update and append in a single...
  3. #2

    Default Re: UPDATE using a query?

    I'm not exactly sure if I understand what you are trying to do, but is this
    close?

    <cfinput type="radio" name="SchedDate" value="05/13/2005" checked="#checked#">
    <input type="hidden" name="userID" value = "strLotusID#">
    paross1 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