
Run-time error -2147217900
I'm getting the following VB error:
Run-time error '-214721900 (80040e14)':
[Microsoft][ODBC Microsoft Access Driver] Syntax error in FROM clause.
The problem occurs after I open a report, close it, then load a form
that accesses the database. When I inspect the SQL statement, there is
no error in it. The problem does not occur if I don't open and close
the reports. The reports seem to leave the database connection open, so
I have the following code to check if the database is still open:
tempval = "'" & txtMonumentName.Text & "'"
queryString = "select * from Monuments where monumentName = " &
tempval
With DataEnvironment1.rscmdMonuments
If .State = adStateClosed Then
.Open queryString
Else
.Close
.Open queryString
End If
If .RecordCount > 0 Then frmPole.Show 1
End With
The problem occurs in the else statement. I close the recordset and
re-open
it with my queryString, and the run-time error occurs. The problem does
not
occur if the database is closed, only if it is open. The queryString is
identical
in both cases, so I don't know why the error occurs.
Any help would be greatly appreciated.
Thanks, Clay