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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Please Help! MS Access Data Access Page

Status
Not open for further replies.

Iashia06

Programmer
Jan 13, 2006
19
0
0
US
Hi,

I have an access application that uses data access pages(daps). I would like to insert a record programmatically. However, I can't seem to get my query working. I'm almost sure I'm using the correct Insert syntax, but instead of inserting a new record, it just updates the current record. Please review the following logic.

I could use all the help I can get.

Thanks in advance,

<SCRIPT language=vbscript event=onclick for=cmdSave>
<!--
On Error Resume Next
Dim strSrc, strSQL, cat1, cmd1, result1

set strSrc = CreateObject("ADODB.Connection")
strSrc.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=\\intraweb\ProjectTracking$\ProjectTracking.mdb;"

TrackingSeq.value = TrackingSeq.value + 1
If TrackingSeq.value <> 1 Then
strSQL = "INSERT INTO Tracking " & _
"(TrackingID, TrackingSeq, ProjectID, ProjectName, Department, " & _
"DeptHead, DeptHeadPhone, ProjectManager, ManagerPhone, Priority, Status, " & _
"PercentComplete, Issues, NextSteps, ReportDate, AchievementLevel, " & _
"WarrantyPeriod, ProjectDescription, Milestone1, Milestone2, Milestone3, " & _
"Milestone4, Milestone5, Milestone6, Milestone7, Milestone8, Milestone9, " & _
"Milestone10, MilestoneStatus1, MilestoneStatus2, MilestoneStatus3, " & _
"MilestoneStatus4, MilestoneStatus5, MilestoneStatus6, MilestoneStatus7, " & _
"MilestoneStatus8, MilestoneStatus9, MilestoneStatus10, " & _
"MilestoneDueDate1, MilestoneDueDate2, MilestoneDueDate3, " & _
"MilestoneDueDate4, MilestoneDueDate5, MilestoneDueDate6, " & _
"MilestoneDueDate7, MilestoneDueDate8, MilestoneDueDate9, " & _
"MilestoneDueDate10, MilestoneStatDesc1, MilestoneStatDesc2, " & _
"MilestoneStatDesc3, MilestoneStatDesc4, MilestoneStatDesc5, " & _
"MilestoneStatDesc6, MilestoneStatDesc7, MilestoneStatDesc8, " & _
"MilestoneStatDesc9, MilestoneStatDesc10 ) " & _
"SELECT TrackingID.value, TrackingSeq.value, ProjectID.value, ProjectName.value, " & _
"Department.value, DeptHead.value, DeptHeadPhone.value, " & _
"ProjectManager.value, ManagerPhone.value, Priority.value, Status.value, " & _
"PercentComplete.value, Issues.value, NextSteps.value, " & _
"ReportDate.value, AchievementLevel.value, " & _
"WarrantyPeriod.value, ProjectDescription.value, Milestone1.value, " & _
"Milestone2.value, Milestone3.value, Milestone4.value, " & _
"Milestone5.value, Milestone6.value, Milestone7.value, " & _
"Milestone8.value, Milestone9.value, Milestone10.value, " & _
"MilestoneStatus1.value, MilestoneStatus2.value, MilestoneStatus3.value, " & _
"MilestoneStatus4.value, MilestoneStatus5.value, MilestoneStatus6.value, " & _
"MilestoneStatus7.value, MilestoneStatus8.value, MilestoneStatus9.value, " & _
"MilestoneStatus10.value, MilestoneDueDate1.value, " & _
"MilestoneDueDate2.value, MilestoneDueDate3.value, " & _
"MilestoneDueDate4.value, MilestoneDueDate5.value, " & _
"MilestoneDueDate6.value, MilestoneDueDate7.value, " & _
"MilestoneDueDate8.value, MilestoneDueDate9.value, " & _
"MilestoneDueDate10.value, MilestoneStatDesc1.value, " & _
"MilestoneStatDesc2.value, MilestoneStatDesc3.value, " & _
"MilestoneStatDesc4.value, MilestoneStatDesc5.value, " & _
"MilestoneStatDesc6.value, MilestoneStatDesc7.value, " & _
"MilestoneStatDesc8.value, MilestoneStatDesc9.value, MilestoneStatDesc10.value " & _
"FROM Tracking;"
End If
MSODSC.Connection.Execute strSQL

-->
</SCRIPT>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top