C
Christopher W. Douglas
I am having an interesting problem with Access 2000 and Visual Basic.NET.
I am developing an application in VB.NET that uses SQL queries to read an
Access database. To test the queries I am building in the code, I cut and
paste the SQL statement into the Access query builder. If I run the query
in Access (the results are showing in Datasheet view), then run the section
of code (in VB.NET) that calls the same table, I get a lock error from
VB.NET:
Could not lock table '_temp_AircraftToWeapon'; currently in use by user
'Admin' on machine 'DOUGLAS'.
This is what I expect, since Access has that table currently displayed.
However, if I go to Access, close the query, then try to open it (either in
Datasheet view or SQL view), I get a "Syntax Error in FROM Clause" message
box in from of the query window. So, I can see the query behind the error
message box, but when I click "OK", the query window closes. I have tried
repairing the database and importing the query into another database, but it
is still corrupted.
Is there any way to repair this query? I appreciate any help.
This is the offending SQL statement:
SELECT t.Aircraft_ID, t.Weapon_ID, r.mtw_id AS RecordExists, r.[AW]
FROM _temp_AircraftToWeapon AS t
LEFT JOIN (SELECT DISTINCT Aircraft_ID, Weapon_ID, mtw_id, [AW] FROM
Region_Valid) AS r
ON t.Aircraft_ID = r.Aircraft_ID AND t.Weapon_ID = r.Weapon_ID
If it helps, I am using Access 2000 and Visual Studio 2003 on Windows Server
2003.
I am developing an application in VB.NET that uses SQL queries to read an
Access database. To test the queries I am building in the code, I cut and
paste the SQL statement into the Access query builder. If I run the query
in Access (the results are showing in Datasheet view), then run the section
of code (in VB.NET) that calls the same table, I get a lock error from
VB.NET:
Could not lock table '_temp_AircraftToWeapon'; currently in use by user
'Admin' on machine 'DOUGLAS'.
This is what I expect, since Access has that table currently displayed.
However, if I go to Access, close the query, then try to open it (either in
Datasheet view or SQL view), I get a "Syntax Error in FROM Clause" message
box in from of the query window. So, I can see the query behind the error
message box, but when I click "OK", the query window closes. I have tried
repairing the database and importing the query into another database, but it
is still corrupted.
Is there any way to repair this query? I appreciate any help.
This is the offending SQL statement:
SELECT t.Aircraft_ID, t.Weapon_ID, r.mtw_id AS RecordExists, r.[AW]
FROM _temp_AircraftToWeapon AS t
LEFT JOIN (SELECT DISTINCT Aircraft_ID, Weapon_ID, mtw_id, [AW] FROM
Region_Valid) AS r
ON t.Aircraft_ID = r.Aircraft_ID AND t.Weapon_ID = r.Weapon_ID
If it helps, I am using Access 2000 and Visual Studio 2003 on Windows Server
2003.