OK, I am at the end my rope here. I have read everything I can find on this and I cannot get anything to work. Please don't send me to Dr Dev's page, its the last thing I tried and the code that I'm presenting with the problem.
Firstly, here is the page
It seems to process the code, but nothing is entered into the second table.
Here is the INSERT code:
HERE IS THE FORM:
Like I said. I have look and looked and looked and while I can edit multiple records and add multiple records to the same table, I cannot add mulitple records to the second table.
THE TABLE STRUCTURE
is the same in both tables. the dates are dates the numbers are numbers and the text is text across both tables.
I want to add the following fields to their corresponding fields in the second table:
Surname -- Surname - (text)
FirstNAme -- Firstname - (text)
Email - Email (text)
Ph -- Ph (text)
Mob -- Mob (text)
GroupID--GroupID (number)
Meet_date -- Meet_Date (Date)
Attended -- Attended (Text)
I have had errors where the code say the variables are of the wrong type, Buffer length too short, expected parameters....I could go on, and on. Frankly, I'm begining to think it cannot be done.
If anybody here can help it. please take me through this STEP - BY - STEP so I can learn and understand why this code is not working.
-------------------------------------------------------------
"The most overlooked advantage of owning a computer is that if they foul up there's no law against whacking them around a bit."
Firstly, here is the page
It seems to process the code, but nothing is entered into the second table.
Here is the INSERT code:
Code:
<%
If request("button")<>"" Then
intRecIDs = Replace(Request("hidRecIDs"), "*", "")
arrRecIDs = Split(intRecIDs, ", ")
For i = 0 to Ubound(arrRecIDs)
sSurname = Replace(Request("Surname" & arrRecIDs(i)), "'", "''")
sFirstname = Replace(Request("FirstName" & arrRecIDs(i)), "'", "''")
sEmail = Replace(Request("Email" & arrRecIDs(i)), "'", "''")
sPh = Replace(Request("Ph" & arrRecIDs(i)), "'", "''")
sMob = Replace(Request("Mob" & arrRecIDs(i)), "'", "''")
sMDate = Replace(Request("Meet_Date" & arrRecIDs(i)), "'", "''")
sGp = Replace(Request("GroupID" & arrRecIDs(i)), "'", "''")
sAttend = Replace(Request("Attended" & arrRecIDs(i)), "'", "''")
Dim MM_editCmd
Set MM_editCmd = Server.CreateObject ("ADODB.Command")
MM_editCmd.ActiveConnection = MM_connect_STRING
MM_editCmd.CommandText = "INSERT INTO attendanceTBL (Surname, Firstname, Email, Ph, Mob, Attended, Meet_Date, GroupID) VALUES"_
& sSurname & "', '" & sFirstname & "', '" & sEmail & "', '" & sPh & "', '" & sMob & "', '"& sAttend & "', '" & sMDate & "', " & sGp & " WHERE RecID = " & arrRecIDs(i)
commUpdate.CommandType = 1
commUpdate.CommandTimeout = 0
commUpdate.Prepared = true
commUpdate.Execute()
Next
strMessage = i & " Records Updated"
Response.Redirect("MbrAttendanceSubmit.asp?Message=" & strMessage)
End If
Dim MM_editRedirectUrl
MM_editRedirectUrl = "MbrAttendanceSubmit.asp"
If (Request.QueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0) Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
Response.Redirect(MM_editRedirectUrl)
End If
%>
HERE IS THE FORM:
Code:
<form id="AddMbrFRM" name="AddMbrFRM" method="POST" action="MbrAttendance.asp">
<span class="normalTxtnobox"> </span>
<table width="642" border="0" cellspacing="2" cellpadding="0">
<tr>
<td width="21" class="heading"> </td>
<td width="91" class="heading">Surname</td>
<td width="90" class="heading">First Name</td>
<td width="180" class="heading">email</td>
<td width="72" class="heading">Phone</td>
<td width="72" class="heading">Mobile</td>
<td width="100" class="heading">Attended</td>
</tr>
<%
While ((Repeat1__numRows <> 0) AND (NOT knectMbr.EOF))
%>
<% if Request("button")<>"" Then %>
<% End If%>
<tr>
<% RecID =(knectMbr.Fields.Item("mbr_ID").Value) ' Store the current RecordID in a variable %>
<%=RecID%>
<td bgcolor="#E2E2E2" class="normalTxtnobox"><input name="HidRecID<%=RecID%>" type="hidden" value="<%=RecID%>" /></td>
<td bgcolor="#E2E2E2" class="normalTxtnobox"><label class="normalTxtnobox">
<input name="Surname<%=RecID%>" type="text" id="Surname" value="<%=(knectMbr.Fields.Item("mbr_Surname").Value)%>" size="15" />
</label></td>
<td bgcolor="#E2E2E2" class="normalTxtnobox"><input name="Firstname<%=RecID%>" type="text" id="Firstname" value="<%=(knectMbr.Fields.Item("mbr_Firstname").Value)%>" size="15" /></td>
<td bgcolor="#E2E2E2" class="normalTxtnobox"><input name="Email<%=RecID%>" type="text" id="Email" value="<%=(knectMbr.Fields.Item("mbr_email").Value)%>" size="30" /></td>
<td bgcolor="#E2E2E2" class="normalTxtnobox"><input name="Ph<%=RecID%>" type="text" id="Ph" value="<%=(knectMbr.Fields.Item("mbr_Ph").Value)%>" size="12" /></td>
<td bgcolor="#E2E2E2" class="normalTxtnobox"><input name="Mob<%=RecID%>" type="text" id="Mob" value="<%=(knectMbr.Fields.Item("mbr_Mob").Value)%>" size="12" /></td>
<td bgcolor="#E2E2E2" class="normalTxtnobox"><label>
<select name="Attended<%=RecID%>" class="normalTxtnobox" id="Attended">
<option value="Yes">Yes</option>
<option value="No">No</option>
</select>
<input name="Meet_Date<%=RecID%>" type="hidden" id="Meet_Date" value="<%=Date() %>" size="12" />
<input name="GroupID<%=RecID%>" type="hidden" id="GroupID" value="11" />
</label></td>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
knectMbr.MoveNext()
Wend
%><tr>
<td colspan="7" align="right" bgcolor="#E2E2E2" class="normalTxtnobox"><label>
<input type="submit" name="button" id="button" value="Submit" />
</label></td>
</tr>
</table>
</form>
Like I said. I have look and looked and looked and while I can edit multiple records and add multiple records to the same table, I cannot add mulitple records to the second table.
THE TABLE STRUCTURE
is the same in both tables. the dates are dates the numbers are numbers and the text is text across both tables.
I want to add the following fields to their corresponding fields in the second table:
Surname -- Surname - (text)
FirstNAme -- Firstname - (text)
Email - Email (text)
Ph -- Ph (text)
Mob -- Mob (text)
GroupID--GroupID (number)
Meet_date -- Meet_Date (Date)
Attended -- Attended (Text)
I have had errors where the code say the variables are of the wrong type, Buffer length too short, expected parameters....I could go on, and on. Frankly, I'm begining to think it cannot be done.
If anybody here can help it. please take me through this STEP - BY - STEP so I can learn and understand why this code is not working.
-------------------------------------------------------------
"The most overlooked advantage of owning a computer is that if they foul up there's no law against whacking them around a bit."