for your 2nd problem, "year" is a reserved word in Access 2000, try
changing it to "tblyear" or something

http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/Q209/1/87.ASP&NoWebContent=1









>>I'm having a problem with an action page that is not
>>passing along an id number as part of a URL. The
>>application is supposed to allow a user to add a new
>>record to a personnel table and then either stop there
>>or click a link to go to another page to add a record
>>into a vehicle table for the person who was added to
>>the personnel table.  The database is Access 2000. The
>>"add-a-user" part works, but it sends empty space
>>instead of the ID autonumber created for the new
>>personnel record to the "add-a-vehicle" page so that
>>it can be put into a new vehicle record, see below:
>>
>>http://localhost:8500/InfoCenter/Parking/addpermitv_test.cfm?PersonnelKey=
>>
>>where I am expecting
>>
>>http://localhost:8500/InfoCenter/Parking/addpermitv_test.cfm?PersonnelKey=21486
>>
>>Here is the pertinent code:
>>
>><cfset NewID = "">
>><cfset PersonnelKey = "">
>><cfquery name="GetNewID" datasource="CMISPersonnel">
>>   Select Max(PersonnelKey) as NewID from Personnel
>></cfquery>
>><cfset PersonnelKey eq #GetNewID.NewID#>
>><cfoutput>
>><p>#Form.FirstName# #Form.LastName# has been added to
>>the personnel database.</p>
>>Click the "Add Permit" link to add permit information
>>for this person.<br>
>>Or make another selection from the menu.
>><p>
>><a
>>href="">>> Permit for #Form.FirstName# #Form.LastName#</a>
>></cfoutput>
>
> It should be:
>
> <cfset PersonnelKey = GetNewID.NewID>
>
> What you're doing right now is a boolean test to see if the current
> value of  PersonnelKey equals GetNewID.NewID. And since you're not
> setting the result  of the boolean test to a variable, the default blank
> string you set for  PersonnelKey is what gets passed.
>
>>
>>That's problem #1. Problem #2 is a little strange; the
>>error message claims that a commented-out line is
>>causing the problem. Originally, I was getting an
>>error message about a syntax error in my INSERT INTO
>>SQL statement. When I commented out the named field to
>>see if I could isolate the error, the new error
>>message referenced the commented line, as below.
>>
>>[MERANT][SequeLink JDBC Driver][ODBC
>>Socket][Microsoft][ODBC Microsoft Access Driver]
>>Syntax error in INSERT INTO statement.
>>
>>The Error Occurred in
>>D:\CFusionMX\wwwroot\InfoCenter\Parking\addpermitv_action_test.cfm:
>> line 25
>>
>>23 : <!-- Temporarily commented   out
>>'#FORM.CarValidateContentFlag#') -->
>>24 :
>>25 : </cfquery>
>>26 : <cfoutput>
>>27 : The new permit information has been submitted.
>>Please make another selection
>>
>>
>>SQL    INSERT INTO Vehicles(PersonnelKey, Year, Make,
>>Model, Color, TagNumber, TagState, DecalNumber,
>>DecalColor, DecalExpiration, InsuranceCompany,
>>PolicyNumber, InsuranceExpirationDate, PermitNumber,
>>IssuedBy, IssueDate, ExpirationDate)
>>VALUES('URL.PersonnelKey', '1982', 'Chrome Wheeled',
>>'Fuel Injected', 'Black', '174CZP', 'AL', '47',
>>'white', '70303', 'State Farm', '42787', '123004',
>>'477', 'ted', '111202', '111204')
>>
>>The first value to be inserted is supposed to be the
>>id number passed along from the previous page -- which
>>at this point is NOT getting passed along -- which
>>makes me wonder if these two issues are connected.
>>Here is the full code for the page giving this error
>>message:
>>
>><!-- Initialize variable -->
>><CFPARAM NAME="FORM.CarValidateContentFlag"
>>DEFAULT="0">
>>
>><html>
>><head>
>><title>Add Permit Action Form</title>
>><meta http-equiv="Content-Type" content="text/html;
>>charset=iso-8859-1">
>></head>
>><body bgcolor="#FFFFFF">
>>  <p>
>>   <font face="Arial, Helvetica, sans-serif"
>>size="+2">Add Permit Action Form</font>
>>  </p>
>>    <cfquery name="AddVehicle"
>>datasource="CMISPersonnel">
>> INSERT INTO Vehicles(PersonnelKey, Year, Make, Model,
>>Color, TagNumber, TagState,
>>   DODDecalNumber, DODDecalColor, DODDecalExpiration,
>>InsuranceCompany, PolicyNumber,
>>    InsuranceExpirationDate, PermitNumber, IssuedBy,
>>IssueDate, ExpirationDate)
>>    <!-- temporarily commented out
>>ValidateContentFlag) -->
>> VALUES('#PersonnelKey#', '#Trim(FORM.Year)#',
>>'#Trim(FORM.Make)#', '#Trim(FORM.Model)#',
>> '#Trim(FORM.Color)#', '#Trim(FORM.TagNumber)#',
>>'#Trim(FORM.TagState)#',
>> '#Trim(FORM.DODDecalNumber)#',
>>'#Trim(FORM.DODDecalColor)#',
>>'#Trim(FORM.DODDecalExpiration)#',
>>   '#Trim(FORM.InsuranceCompany)#',
>>'#Trim(FORM.PolicyNumber)#',
>>'#Trim(FORM.InsuranceExpirationDate)#',
>>   '#Trim(FORM.PermitNumber)#',
>>'#Trim(FORM.IssuedBy)#', '#Trim(FORM.IssuedDate)#',
>>'#Trim(FORM.ExpirationDate)#')
>> <!-- Temporarily commented out
>>'#FORM.CarValidateContentFlag#') -->
>>
>></cfquery>
>><cfoutput>
>>The new permit information has been submitted. Please
>>make another selection
>>from the menu to continue.
>></cfoutput>
>></body>
>></html>
>>
>>Can anyone help me figure this out? Thanks.
>
> Try using SQL comments instead of ColdFusion's ( -- vs. <!--- --->).
>
> Regards,
> Dave.
>
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to