I'm using ASP to display menus & content from an Access database.
The main menu table (tblMainMenu) had field names "m_id", "m_title", etc. The sub-menu table (tblSubMenu) had field names "m_id", "m_title", etc. I found this confusing when coding.
The SQL statement started like this: "SELECT tblMainMenu.m_title, tblSubMenu.m_title, ......."
So today I changed the names of the sub-menu fields to "s_id", "s_title", etc. I changed the SQL statement accordingly but found the Web page gave this error: "ADODB.Recordset error '800a0cc1'. Item cannot be found in the collection corresponding to the requested name or ordinal."
The SQL statement now looks like this: "SELECT tblMainMenu.m_title, tblSubMenu.s_title, ......."
This is the line on the Web page where the problem occurs:
mySubmenuTitle = rs("tblSubMenu.s_title"
I found that if I remove the table name then it works fine. I guess that this is something to do with the fact that "m_title" wasn't unique before and so I needed the table name to clarify which "m_title" I was referring to. But now, "s_title" is unique and so I don't need the table name. But why should it cause a problem if I include the table name? Surely it should just be optional, just like brackets are optional when clarifying expressions?
I've noticed this problem several times in the past. Any ideas why? I'm not happy just accepting this as it is. Is there a good reason why the table name is not just optional?
Thanks,
May
The main menu table (tblMainMenu) had field names "m_id", "m_title", etc. The sub-menu table (tblSubMenu) had field names "m_id", "m_title", etc. I found this confusing when coding.
The SQL statement started like this: "SELECT tblMainMenu.m_title, tblSubMenu.m_title, ......."
So today I changed the names of the sub-menu fields to "s_id", "s_title", etc. I changed the SQL statement accordingly but found the Web page gave this error: "ADODB.Recordset error '800a0cc1'. Item cannot be found in the collection corresponding to the requested name or ordinal."
The SQL statement now looks like this: "SELECT tblMainMenu.m_title, tblSubMenu.s_title, ......."
This is the line on the Web page where the problem occurs:
mySubmenuTitle = rs("tblSubMenu.s_title"
I found that if I remove the table name then it works fine. I guess that this is something to do with the fact that "m_title" wasn't unique before and so I needed the table name to clarify which "m_title" I was referring to. But now, "s_title" is unique and so I don't need the table name. But why should it cause a problem if I include the table name? Surely it should just be optional, just like brackets are optional when clarifying expressions?
I've noticed this problem several times in the past. Any ideas why? I'm not happy just accepting this as it is. Is there a good reason why the table name is not just optional?
Thanks,
May