Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Enter multiple rows of info. into access

Status
Not open for further replies.

peter11

Instructor
Joined
Mar 16, 2001
Messages
334
Location
US
I included the first 2 pages of code and the section of the thhird page where I get the error. The first page allows the user to choose how many rows of info. to enter (this works fine) Going from the second to the third page I get a type mismatch error:
<!--PAGE 1-->
<HTML>

<HEAD>
<TITLE>Add a Game</TITLE></HEAD>



<FORM ACTION=&quot;gameadd1a.cfm&quot; METHOD=&quot;POST&quot;>
<table width=&quot;755&quot; border=&quot;0&quot; align=&quot;left&quot;>
<TR>
<td colspan=&quot;5&quot;><FONT size=&quot;3&quot; face=&quot;Arial, Helvetica, sans-serif&quot;><IMG src=&quot;rict_header.gif&quot; width=&quot;252&quot; height=&quot;45&quot; alt=&quot;District Heading&quot;></FONT></td>
</TR>
<TR>
<TD colspan=&quot;5&quot; height=&quot;20&quot; valign=&quot;top&quot; align=&quot;center&quot; bgcolor=&quot;#003300&quot;>&nbsp;
</TD>
</TR>
<TR>
<TD colspan=&quot;5&quot; height=&quot;20&quot; valign=&quot;top&quot; align=&quot;center&quot; bgcolor=&quot;#eaaf00&quot;><b><font size=&quot;3&quot; face=&quot;Arial, Helvetica, sans-serif&quot;>Game
Additions</font></b>
</TR>
<TR>
<TD colspan=&quot;5&quot; height=&quot;20&quot; valign=&quot;top&quot; align=&quot;center&quot;>
<H3><font size=&quot;3&quot; face=&quot;Arial, Helvetica, sans-serif&quot;></font></H3>
</TD>
</TR>
<TR>
<TD colspan=&quot;5&quot; height=&quot;20&quot; valign=&quot;top&quot; align=&quot;left&quot;><b><font face=&quot;Arial, Helvetica, sans-serif&quot;>How
many games do you want to add?</font></b> </TD>
</TR>
<tr>
<td valign=&quot;top&quot;><font face=&quot;Arial, Helvetica, sans-serif&quot; size=&quot;2&quot;>Please
enter the number of games you would like to add to the schedule:
<INPUT TYPE=&quot;text&quot; NAME=&quot;num&quot; SIZE=&quot;4&quot; MAXLENGTH=&quot;2&quot; value=&quot;1&quot;>
</font> </td>
</tr>
<tr>
<td> <input type=&quot;submit&quot; value=&quot;Add Game(s)&quot; name=&quot;submit&quot;>
<input type=&quot;reset&quot; value=&quot;Clear&quot; name=&quot;reset&quot;>
</td>
</tr>
</table>
</FORM>
</BODY>
</HTML>


<!--END of PAGE 1-->

<!--PAGE 2-->
<HTML>

<HEAD>
<TITLE>Add a Game</TITLE>

</HEAD>
<BODY marginheight=&quot;8&quot; marginwidth=&quot;8&quot; topmargin=&quot;8&quot; leftmargin=&quot;8&quot;>


<FORM ACTION=&quot;gameadd2a.cfm&quot; METHOD=&quot;POST&quot;>
<table width=&quot;755&quot; border=&quot;0&quot; align=&quot;left&quot;>
<TR>
<td colspan=&quot;5&quot;><FONT size=&quot;3&quot; face=&quot;Arial, Helvetica, sans-serif&quot;><IMG src=&quot; width=&quot;252&quot; height=&quot;45&quot; alt=&quot;District Heading&quot;></FONT></td>
</TR>
<TR>
<TD colspan=&quot;5&quot; height=&quot;20&quot; valign=&quot;top&quot; align=&quot;center&quot; bgcolor=&quot;#003300&quot;>&nbsp;
</TD>
</TR>
<TR>
<TD colspan=&quot;5&quot; height=&quot;20&quot; valign=&quot;top&quot; align=&quot;center&quot; bgcolor=&quot;#eaaf00&quot;><b><font size=&quot;3&quot; face=&quot;Arial, Helvetica, sans-serif&quot;>Game
Additions</font></b>
</TR>
<tr>
<td>
<table width=&quot;100%&quot; border=&quot;1&quot; cellspacing=&quot;1&quot; cellpadding=&quot;1&quot;>
<tr valign=&quot;top&quot;>
<th height=&quot;2&quot;><font face=&quot;Arial,Helvetica,sans-serif&quot;>Team</font></th>
<th height=&quot;2&quot;><font face=&quot;Arial,Arial,Helvetica,sans-serif&quot;>Date<br>
<font size=&quot;1&quot;>Use the following Date format: <font color=&quot;#FF0000&quot;>09/12/2001</font></font></font></th>
<th height=&quot;2&quot;><font face=&quot;Arial,Arial,Helvetica,sans-serif&quot;>Time</font></th>
<th height=&quot;2&quot;><font face=&quot;Arial,Helvetica,sans-serif&quot;>Site</font></th>
<th height=&quot;2&quot;><font face=&quot;Arial,Helvetica,sans-serif&quot;>Opponent</font></th>
</tr>
<cfoutput>
<tr>
<td>
<INPUT TYPE=&quot;hidden&quot; NAME=&quot;num&quot; value=&quot;#num#&quot;>
</td>
</tr>
</cfoutput>
<CFLOOP FROM =&quot;1&quot; TO=&quot;#NUM#&quot; INDEX=&quot;i&quot;>
<CFOUTPUT>
<tr valign=&quot;bottom&quot;>
<td align=&quot;center&quot;>
<Select Name=&quot;SportID#i#&quot;>
<option Value=&quot;&quot;>
<option value=&quot;1&quot;>Varsity Football
<option Value=&quot;2&quot;>Varsity Cross Country
<option Value=&quot;3&quot;>Varsity Boys Soccer
<option Value=&quot;4&quot;>Varsity Girls Soccer
<option Value=&quot;5&quot;>Varsity Volleyball
<option Value=&quot;6&quot;>Varsity Girls Tennis
<option Value=&quot;7&quot;>Varsity Swimming
<option Value=&quot;8&quot;>JV Football
<option Value=&quot;9&quot;>JV Boys Soccer
<option Value=&quot;10&quot;>JV Girls Soccer
<option Value=&quot;11&quot;>JV Girls Volleyball
</select>
</td>
<td align=&quot;center&quot;>
<INPUT TYPE=&quot;text&quot; NAME=&quot;Sched_Date#i#&quot; SIZE=&quot;21&quot; MAXLENGTH=&quot;21&quot; value=&quot;09/12/2001&quot;>
</td>
<td align=&quot;center&quot;> <font face=&quot;Arial,Helvetica,sans-serif&quot;>
<table width=&quot;100%&quot; border=&quot;0&quot; align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;>
<tr>
<th><font size=&quot;1&quot;>Hour</font></th>
<th><font size=&quot;1&quot;>Minutes</font></th>
<th><font size=&quot;1&quot;>AM/PM</font></th>
</tr>
<tr>
<th>
<Select Name=&quot;Hour#i#&quot;>
<option Value=&quot;TBA&quot;>TBA
<option Value=&quot;1:&quot;>1
<option Value=&quot;2:&quot;>2
<option Value=&quot;3:&quot;>3
<option Value=&quot;4:&quot;>4
<option Value=&quot;5:&quot;>5
<option Value=&quot;6:&quot;>6
<option Value=&quot;7:&quot;>7
<option Value=&quot;8:&quot;>8
<option Value=&quot;9:&quot;>9
<option Value=&quot;10:&quot;>10
<option Value=&quot;11:&quot;>11
<option Value=&quot;1:&quot;>12
</select>
</th>
<th>
<Select Name=&quot;Minutes#i#&quot;>
<option Value=&quot; &quot;>
<option Value=&quot;00&quot;>00
<option Value=&quot;15&quot;>15
<option Value=&quot;30&quot;>30
<option Value=&quot;45&quot;>45
</select>
</th>
<th>
<Select Name=&quot;Meridian#i#&quot;>
<option Value=&quot; &quot;>
<option Value=&quot;AM&quot;>AM
<option Value=&quot;PM&quot;>PM
</select>
</th>
</tr>
</table>
</font> </td>
<td align=&quot;center&quot;>
<Select Name=&quot;Site#i#&quot;>
<option Value=&quot;Home&quot;>Home
<option Value=&quot;Away&quot;>Away
</select>
</td>
<td align=&quot;center&quot;>
<Select Name=&quot;OpponentID#i#&quot;>
<option Value=&quot;16&quot;>Brown Invitational
<option Value=&quot;23&quot;>Carey
<option Value=&quot;45&quot;>Chaminade
<option Value=&quot;2&quot;>Clarke
<option Value=&quot;40&quot;>Cold Spring Harbor
<option Value=&quot;18&quot;>Conf. Championship(X-C)
<option Value=&quot;12&quot;>Division(X-C)
<option Value=&quot;41&quot;>Freeport
<option Value=&quot;20&quot;>Friends Academy
<option Value=&quot;19&quot;>Frosh/Soph Champ.
<option Value=&quot;28&quot;>Garden City
<option Value=&quot;33&quot;>Glen Cove
<option Value=&quot;35&quot;>Great Neck North
<option Value=&quot;39&quot;>Great Neck South
<option Value=&quot;24&quot;>Herricks
<option Value=&quot;31&quot;>Hewlett
<option Value=&quot;44&quot;>Hicksville
<option Value=&quot;6&quot;>Jericho
<option Value=&quot;3&quot;>Jim Smith Inv.(X-C)
<option Value=&quot;27&quot;>Kennedy Belmore
<option Value=&quot;26&quot;>Lawrence
<option Value=&quot;9&quot;>Levittown Division(FOOTBALL)
<option Value=&quot;37&quot;>Long Beach
<option Value=&quot;21&quot;>Mac Arthur
<option Value=&quot;36&quot;>Manhasset
<option Value=&quot;15&quot;>Manhattan College Inv.(X-C)
<option Value=&quot;4&quot;>Mineola
<option Value=&quot;17&quot;>Nassau Coaches Inv.(X-C)
<option Value=&quot;34&quot;>North Shore
<option Value=&quot;13&quot;>NYC PSAL(X-C)
<option Value=&quot;22&quot;>Plainedge
<option Value=&quot;42&quot;>Plainview JFK
<option Value=&quot;32&quot;>Port Washington
<option Value=&quot;1&quot;>Roslyn
<option Value=&quot;30&quot;>Seaford
<option Value=&quot;10&quot;>Sewanhaka
<option Value=&quot;29&quot;>South Side
<option Value=&quot;14&quot;>St. Anthony's Inv.(X-C)
<option Value=&quot;11&quot;>Suff. Coaches Inv.(X-C)
<option Value=&quot;38&quot;>Uniondale
<option Value=&quot;25&quot;>Valley Stream South
<option Value=&quot;5&quot;>Wantagh
<option Value=&quot;7&quot;>West Hemstead
<option Value=&quot;8&quot;>West Hemstead (HC)
</select>
</td>
</tr>
</CFOUTPUT>
</CFLOOP>
<tr align=&quot;left&quot;>
<td colspan=&quot;5&quot;>
<input type=&quot;submit&quot; value=&quot;Add Game(s)&quot; name=&quot;submit&quot;>
<input type=&quot;reset&quot; value=&quot;Clear&quot; name=&quot;reset&quot;>
</td>
</tr>
</table>
</td>
</tr>
</table>
</FORM>
</BODY>
</HTML>


<!--END of PAGE 2-->


<!--PAGE 3-->


<CFLOOP FROM =&quot;1&quot; TO=&quot;#NUM#&quot; INDEX=&quot;i&quot;>

<CFQUERY DATASOURCE=&quot;sports&quot;>
INSERT INTO Schedule (SportID, Site, Sched_Date, Hour, Minutes, Meridian, OpponentID)
VALUES(SportID#i#, Site#i#', 'Sched_Date#i#', 'Hour#i#', 'Minutes#i#', 'Meridian#i#', 'OpponentID#i#')
</CFQUERY>
</cfloop>

<CFQUERY DATASOURCE=&quot;sports&quot; NAME=&quot;schedule1&quot;>
SELECT sportid,
opponentid

FROM schedule
</CFQUERY>
<cfoutput query =&quot;schedule1&quot;>
<CFQUERY DATASOURCE=&quot;sports&quot; NAME=&quot;schedule&quot;>
SELECT id,
teamname,
oppid,
opponentname

FROM team, opponent
WHERE #sportid# = id and #opponentid# = oppid





<!--END of PAGE 3-->
 


What data type is &quot;Sched_Date&quot;?

If its date/time then you need to lose the single quotes.

Most likely you have/or don't single quotes around the correct values.
Any number or date/time fields don't get them.

Good luck
 
I think the problem is right here:


<CFLOOP FROM =&quot;1&quot; TO=&quot;#NUM#&quot; INDEX=&quot;i&quot;>

<CFQUERY DATASOURCE=&quot;sports&quot;>
INSERT INTO Schedule (SportID, Site, Sched_Date, Hour, Minutes, Meridian, OpponentID)
VALUES(SportID#i#, Site#i#', 'Sched_Date#i#', 'Hour#i#', 'Minutes#i#', 'Meridian#i#', 'OpponentID#i#')
</CFQUERY>
</cfloop>


You're saying &quot;insert into Schedule ...&quot;
and giving these values (e.g., if I only choose one game and the &quot;id&quot; value is 1) to insert; your query looks like this:

<CFQUERY DATASOURCE=&quot;sports&quot;>
INSERT INTO Schedule (SportID, Site, Sched_Date, Hour, Minutes, Meridian, OpponentID)
VALUES(SportID1, Site1', 'Sched_Date1', 'Hour1', 'Minutes1', 'Meridian1', 'OpponentID1')
</CFQUERY>

I suspect your database field called &quot;SportID&quot; is numeric, and yet you are passing it a value of SportID1, which is a string, whether or not you put single ticks around it.

I think that is the problem.

John Hoarty
jhoarty@quickestore.com
 
Dear Dallasweb,
I removed the sindgle quotes but I now recieve the folowing error:
Undefined function 'evaluate' in expression.

Should I be using double quotes or should it look like the following:
INSERT INTO Schedule (SportID, Site, Sched_Date, Hour, Minutes,
Meridian, OpponentID)
VALUES(evaluate(SportID#i#), 'evaluate(Site#i#)',
evaluate(Sched_Date#i#), 'evaluate(Hour#i#)',
'evaluate(Minutes#i#)', 'evaluate(Meridian#i#)',
evaluate(OpponentID#i#))
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top