| | |
|
|
|
Can't Find Query Error |
| message from =?Utf-8?B?Um9zY28=?= on 14 May 2004 |
Can someone see my error in the following code. I get an "Access can't see query error on the OpenQuery command.
The query is built in the proper place, however.
Function RunQuery()
Dim wrkJet As Workspace, dbBackEnd As Database, qd As QueryDef, strPath As String, strFileNme As String
Dim sqlString As String
'DoCmd.SetWarnings False
strPath = "H:\Development\FolderName\"
strFileNme = "File_BE.mdb"
sqlString = "some sql to make table query string "
Set wrkJet = CreateWorkspace("", "admin", "", dbUseJet)
Set dbBackEnd = wrkJet.OpenDatabase(strPath & strFileNme)
With dbBackEnd
Set qd = .CreateQueryDef("qryQueryName", sqlString)
DoCmd.OpenQuery "qryQueryName", acViewNormal, acEdit
.QueryDefs.Delete qd.Name
End With
'DoCmd.SetWarnings True
End Function
Thanks for the Help
Rosco
|
| Van T. Dinh replied to =?Utf-8?B?Um9zY28=?= on 14 May 2004 |
DoEvents
once or twice after the statement "Set qd ..." and before the
"DoCmd.OpenQuery ..."
|
| =?Utf-8?B?Um9zY28=?= replied to Van T. Dinh on 14 May 2004 |
No soap, Van. Still getting the "Can't find the object" error.
Thanks for trying, any other suggestions?
Rosco
|
| Van T. Dinh replied to =?Utf-8?B?Um9zY28=?= on 14 May 2004 |
Just realised that you created the query in the Back-End and the
DoCmd.OpenQuery will only look for the Query in the Front-End.
|
| =?Utf-8?B?Um9zY28=?= replied to Van T. Dinh on 14 May 2004 |
So, how can I run a query on the back end, from the front end. I am trying to update a table on the back end as part of a start up routine. The query grabs data from an AS400 table, and I do not want to give the users direct access to the AS400 table in question.
Thanks
|
| =?Utf-8?B?Um9zY28=?= replied to =?Utf-8?B?Um9zY28=?= on 14 May 2004 |
Found the answer
With dbBackEnd
Set qd = .CreateQueryDef("qryQueryName", sqlString)
.QueryDefs.Delete qd.Name
End With
Rosco :-)
|
| Van T. Dinh replied to =?Utf-8?B?Um9zY28=?= on 15 May 2004 |
.Execute sqlString
|
|
Archived message: Can't Find Query Error (Microsoft Access)