This topic is locked

Delete a record from and under lying table

2/20/2006 2:55:29 AM
ASPRunnerPro General questions
B
blacksuperman author

Hi,

It seems that the need has come up to display fields from more than one table in an Access query and the primary table that the data is coming from has a primary key. I have added some custom code to the template with the purpose of deletion of a record from the table where the main data comes from.
case "[the_multi_table_query]"

strOriginalTableName="[the_underlying_table_to_deletefrom]"

strSQL="delete from " & strOriginalTableName &


" where " & strOriginalTableName & ".[PK_Field]=" & key
The deletion works but afterwards I get a
Microsoft VBScript runtime error '800a01c9'

This key is already associated with an element of this collection
as the page tries to reload itself right in the code below with the arrows ........
Set FieldsList = CreateObject("Scripting.Dictionary")

for i=0 to rs.Fields.Count-1

>>>>>[here] FieldsList.Add rs.Fields(i).Name, CStr(i+1)

next
Has anyone seen this before?
TIA,

Dave

Sergey Kornilov admin 2/20/2006

Dave,
It seems that your query returns duplicate field names.

Try to use the field alias.

For example

select

table1.name

table2.name as name2