Database insert puzzle

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

  1. #1

    Default Database insert puzzle

    I have three forms:
    Choose Login
    Enter company information
    Enter financial information
    ...in sequence where the data needs to go into the same record in the db.

    The only way I can get close is to turn on client management in
    application.cfm and set the data as variables using <CFSET>. I then use INSERT
    INTO to get the data into the database.

    This seems pretty mickey mouse to me and I have a further problem: I can't set
    checkbox data as a variable.

    So: how do I get the data from my forms -- with the check box info--into the
    same record in the db?


    mxr618 Guest

  2. Similar Questions and Discussions

    1. Database Insert Error
      :confused; I am inserting data into three tables, and the insert statements have a similar format but I get an error saying that I am Missing...
    2. how to insert data into database
      i already make a form and database with access...and now i want to know how the data will insert automatically into the database...another one, how...
    3. Database Insert
      Is there anybody out there who has worked through the Jeffrey Bardzell book "Dreamweaver MX 2004 with asp, Coldfusion and php"? By various means I...
    4. insert data into database
      :confused; Please help, I haven't got a clue what I am doing. I have a page that I wish people to enter data then submit it to a Microsoft SQL...
    5. Date Insert puzzle :: 05/23/76 becomes 12: 12:13
      I'm tearing out my hair here: ACCESS 2000: When I attempt to overwrite a date in my date field with a new user selected valid date eg: 05/23/99...
  3. #2

    Default Re: Database insert puzzle

    Hi

    Are you using the 3 forms in the same page,

    if the 3 forms are in 3 different pages then you can do it easily.

    in the first page action use the insert command and pass that inserted it to
    the next 2 pages
    in the next 2 pages use the update command tp update to the same record.

    if all the 3 forms are in the same page then you do the same action as i
    said above.
    but here the page will be refresh for each form subimission.


    vkunirs Guest

  4. #3

    Default Re: Database insert puzzle

    ok, i'm with you so far...there are three separate pages. if the second page
    triggers the INSERT action, do I then capture the ID and pass it to the third
    page's action?

    thanks for your help...we're getting closer

    mxr618 Guest

  5. #4

    Default Re: Database insert puzzle

    Hi

    Ya...you are correct.

    if you are inserting the record in the second page.
    there it self find out the id of that last record and forward it to the next
    page through url or form inputs
    so in the next page use the update command to update the require field.

    thats it.

    vkunirs Guest

  6. #5

    Default Re: Database insert puzzle

    Two alternatives:

    1. Put all your fields on the same page into one and the same form or
    2. Have your forms on 3 different forms which you present sequentially:
    After the first form, insert the data into the DB, get the primary key
    ID created and pass it to the second form.

    After the second form, update the same record (using the same ID) with
    the additional data.

    Same after third form.

    mxr618 wrote:
    > I have three forms:
    > Choose Login
    > Enter company information
    > Enter financial information
    > ...in sequence where the data needs to go into the same record in the db.
    >
    > The only way I can get close is to turn on client management in
    > application.cfm and set the data as variables using <CFSET>. I then use INSERT
    > INTO to get the data into the database.
    >
    > This seems pretty mickey mouse to me and I have a further problem: I can't set
    > checkbox data as a variable.
    >
    > So: how do I get the data from my forms -- with the check box info--into the
    > same record in the db?
    >
    >
    ben Guest

  7. #6

    Default Re: Database insert puzzle

    This is exactly what I am trying to do with an online employment application
    for my company. I have four access data base tables set up. My primary key is
    AppRec (Auto Number Field) in my first table. Form 1 writes to this table and
    Access increments the value of AppRec. We then open Form 2 which writes to
    table two. Table two has a foreign key (AppRec) which is tied to the Primary
    Key AppRec in table one. When I open Form 2 I want to add the Primary Key Value
    from Table 1 to the AppRec field in Form 2.

    Ben's response is exactly what I am looking for but being kind of new to Cold
    Fusion I was hoping I could get more specific information about how to set this
    up.

    Thanks

    Charles Masteller


    kaneohe dreamer Guest

  8. #7

    Default Re: Database insert puzzle

    As far as the checkbox issue, you're probably running into a very common
    situation. If a checkbox isn't checked on a form, it isn't considered defined
    and you get errors relating to that. Simply add code to check for the
    condition of each checkbox field before inserting data... <cfif Not
    IsDefined('form.cbField')> <cfset form.cbField = ''> </cfif>

    KulaRider Guest

  9. #8

    Default Re: Database insert puzzle

    When you open Form2, include the AppRec key - which you can retrieve
    after having inserted the recordfrom Form2 - as a hidden field in Form2.
    Then when you submit Form2, use this AppRec in the action page for Form2.

    Ben

    kaneohe dreamer wrote:
    > This is exactly what I am trying to do with an online employment application
    > for my company. I have four access data base tables set up. My primary key is
    > AppRec (Auto Number Field) in my first table. Form 1 writes to this table and
    > Access increments the value of AppRec. We then open Form 2 which writes to
    > table two. Table two has a foreign key (AppRec) which is tied to the Primary
    > Key AppRec in table one. When I open Form 2 I want to add the Primary Key Value
    > from Table 1 to the AppRec field in Form 2.
    >
    > Ben's response is exactly what I am looking for but being kind of new to Cold
    > Fusion I was hoping I could get more specific information about how to set this
    > up.
    >
    > Thanks
    >
    > Charles Masteller
    >
    >
    ben 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