I am having a heck of a time trying to figure out what is wrong with the following chunk of code. Maybe a new look at it from someone else might see the issue. Thanks...
>>>>>>>>> CODE <<<<<<<<<<<<<<<
Dim loConn, lsSQL, loRs
Set loConn = CreateObject("ADODB.Connection")
' Open a connection to the database
loConn.Open ConnectionString()
' Insert a new record into the table
lsSQL = "SET NOCOUNT ON;" &_
"INSERT INTO WorkOrders" &_
"(Issue,IssueDate,IssueBy,Milage,Priority,UnitID,DeptID,Status,OilWaterFuel,Lights,Mirrors,Breakaway,Wheels,Body,Service,Horn,Steering,WarningGauges,LowAir,Brakes,Engine)" &_
"VALUES ('" & varIssue & "','" & varDate & "'," & varUser & "," & varMilage & "," &_
"'" & varPriority & "'," & varUnitID & "," & varDeptID & ",'" & varStatus & "'," &_
"'" & varOil & "','" & varLights & "','" & varMirrors & "','" & varBreakaway & "'," &_
"'" & varWheels & "','" & varBody & "','" & varService & "','" & varHorn & "'," &_
"'" & varSteering & "','" & varWarning & "','" & varLowAir & "','" & varBrakes & "','" & varEngine & "');" &_
"SELECT @@IDENTITY AS NewID;"
' Execute the SQL statement
Set loRs = loConn.Execute(lsSQL)
' Get the inserted ID
intNewID = loRs.Fields("NewID").value
' Close the connection
loConn.Close()
Set loConn = Nothing
>>>>>>>>>>>>>>>>> END Code <<<<<<<<<<<<<<<<<
the connection string which is located in an include file (.asp) looks like:
ConnectionString = "DSN=NoneYaBusiness;UID=someID;PWD=somePass;"
also, DeptID, UnitID, IssueBy and milage are integers
Thanks for your help,
Mike Diaz...
>>>>>>>>> CODE <<<<<<<<<<<<<<<
Dim loConn, lsSQL, loRs
Set loConn = CreateObject("ADODB.Connection")
' Open a connection to the database
loConn.Open ConnectionString()
' Insert a new record into the table
lsSQL = "SET NOCOUNT ON;" &_
"INSERT INTO WorkOrders" &_
"(Issue,IssueDate,IssueBy,Milage,Priority,UnitID,DeptID,Status,OilWaterFuel,Lights,Mirrors,Breakaway,Wheels,Body,Service,Horn,Steering,WarningGauges,LowAir,Brakes,Engine)" &_
"VALUES ('" & varIssue & "','" & varDate & "'," & varUser & "," & varMilage & "," &_
"'" & varPriority & "'," & varUnitID & "," & varDeptID & ",'" & varStatus & "'," &_
"'" & varOil & "','" & varLights & "','" & varMirrors & "','" & varBreakaway & "'," &_
"'" & varWheels & "','" & varBody & "','" & varService & "','" & varHorn & "'," &_
"'" & varSteering & "','" & varWarning & "','" & varLowAir & "','" & varBrakes & "','" & varEngine & "');" &_
"SELECT @@IDENTITY AS NewID;"
' Execute the SQL statement
Set loRs = loConn.Execute(lsSQL)
' Get the inserted ID
intNewID = loRs.Fields("NewID").value
' Close the connection
loConn.Close()
Set loConn = Nothing
>>>>>>>>>>>>>>>>> END Code <<<<<<<<<<<<<<<<<
the connection string which is located in an include file (.asp) looks like:
ConnectionString = "DSN=NoneYaBusiness;UID=someID;PWD=somePass;"
also, DeptID, UnitID, IssueBy and milage are integers
Thanks for your help,
Mike Diaz...