Answered
Updating a table via form
Hello -
I'm trying to do what (should) be an easy task, but i'm pulling out what's left of my hair. I can't seem to update an Access table.
tble_message has the following fields:
messagesID : autonumber/key
to [data type number]
from [data type text]
Date [data type Date/Time]
message [data type text]
time [data type Date/Time]
I created the following form:
- - - begin form.cfm - - -
<FORM ACTION="input2.cfm?newcall2=YES&toID=#URLEncodedFormat(toID)#&budName=#URLEncodedFormat(budname)#" Method=Post>
<INPUT TYPE="hidden" NAME="to" VALUE=<cfoutput>#toID#</cfoutput>>
<INPUT TYPE="HIDDEN" NAME="from" value=<cfoutput>"#LoginName#"</cfoutput>>
<INPUT TYPE="hidden" NAME="DATASOURCE" VALUE="testdb">
<INPUT TYPE="hidden" NAME="TABLENAME" VALUE="tbl_Messages">
Message to: <cfoutput>#budName#</cfoutput>
<TEXTAREA NAME="YMESSAGE" ROWS="5" COLS="40" WRAP="Virtual"></TEXTAREA>
<INPUT TYPE="Submit" VALUE="send message">
<INPUT Type="reset" Value="start again">
</form>
- - - end form.cfm - - -
this form feeds input2.cfm
- - - begin input2.cfm - - -
<cfoutput>
#message#
#toid#
#loginName#
</cfoutput>
<cfquery name="addmess" DATASOURCE="testdb">
Insert Into tbl_Messages
(message,to,from)
Values
('<cfoutput>#message#</cfoutput>','<cfoutput>#toid#</cfoutput>','<cfoutput>#loginName#</cfoutput>'
)
</CFQUERY>
- - - end input2.cfm - - -
i do see the expected values in my cfoutput:
<cfoutput>
#message#
#toid#
#loginName#
</cfoutput>
= = = error message = = =
I am getting an Error Executing Database Query
[Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft]
[ODBC Microsoft Access Driver] Syntax error in Insert Into statement
the error occurred in c:\.... input2.cfm: line 21
20 Values
21 ('<cfoutput>#message#</cfoutput>','<cfoutput>#toid#</cfoutput>','<cfoutput>#loginName#</cfoutput>')
22 </CFQUERY>
= = = end error message = = =
Form Fields:
fieldnames:to,from,datasource,tablename,ymessage
from=chancho2000
tablename=tbl_messages
to=100
ymessage=testing the input form
url parameters:
newcall2=yes
toID=
.. i just can't seem to populate the database
any help or direction would be appreciated.. thanks!
dieg0
I'm trying to do what (should) be an easy task, but i'm pulling out what's left of my hair. I can't seem to update an Access table.
tble_message has the following fields:
messagesID : autonumber/key
to [data type number]
from [data type text]
Date [data type Date/Time]
message [data type text]
time [data type Date/Time]
I created the following form:
- - - begin form.cfm - - -
<FORM ACTION="input2.cfm?newcall2=YES&toID=#URLEncodedFormat(toID)#&budName=#URLEncodedFormat(budname)#" Method=Post>
<INPUT TYPE="hidden" NAME="to" VALUE=<cfoutput>#toID#</cfoutput>>
<INPUT TYPE="HIDDEN" NAME="from" value=<cfoutput>"#LoginName#"</cfoutput>>
<INPUT TYPE="hidden" NAME="DATASOURCE" VALUE="testdb">
<INPUT TYPE="hidden" NAME="TABLENAME" VALUE="tbl_Messages">
Message to: <cfoutput>#budName#</cfoutput>
<TEXTAREA NAME="YMESSAGE" ROWS="5" COLS="40" WRAP="Virtual"></TEXTAREA>
<INPUT TYPE="Submit" VALUE="send message">
<INPUT Type="reset" Value="start again">
</form>
- - - end form.cfm - - -
this form feeds input2.cfm
- - - begin input2.cfm - - -
<cfoutput>
#message#
#toid#
#loginName#
</cfoutput>
<cfquery name="addmess" DATASOURCE="testdb">
Insert Into tbl_Messages
(message,to,from)
Values
('<cfoutput>#message#</cfoutput>','<cfoutput>#toid#</cfoutput>','<cfoutput>#loginName#</cfoutput>'
)
</CFQUERY>
- - - end input2.cfm - - -
i do see the expected values in my cfoutput:
<cfoutput>
#message#
#toid#
#loginName#
</cfoutput>
= = = error message = = =
I am getting an Error Executing Database Query
[Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft]
[ODBC Microsoft Access Driver] Syntax error in Insert Into statement
the error occurred in c:\.... input2.cfm: line 21
20 Values
21 ('<cfoutput>#message#</cfoutput>','<cfoutput>#toid#</cfoutput>','<cfoutput>#loginName#</cfoutput>')
22 </CFQUERY>
= = = end error message = = =
Form Fields:
fieldnames:to,from,datasource,tablename,ymessage
from=chancho2000
tablename=tbl_messages
to=100
ymessage=testing the input form
url parameters:
newcall2=yes
toID=
.. i just can't seem to populate the database
any help or direction would be appreciated.. thanks!
dieg0
