Solved

Error 3065 - Cant execute a Select Query

Posted on 2014-01-04
9
739 Views
Last Modified: 2014-01-05
Experts,

What is Error 3065?  Not sure what is setting off the error if it Appends correctly.  

Thank you


Private Sub cmdNewProject_Click()

        On Error GoTo EH

    Dim rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset("select * from Projects where 1=0")

With rs
    .AddNew
    ![Created By] = Nz([TempVars]![CurrentUserID], 0)
    ![Status2] = 7
    ![Currency] = DLookup("CurrencyID", "tblCurrencyExchange", "[Currency] = '" & Me.txtCur & "'")
    ![ProjectNo] = Me.txtActivityCode
    ![Project Name] = "LC Ref: (delete it after appending if want): " & Me.txtLCRef & ", Project Name: " & Me.txtActivityDescription
    ![Start Date] = Date
    ![Notes] = "****APPENDED LC FROM CSM*****: " & Format(Date, "m\/d\/yyyy") & ", Beneficiary :" & Me.txtBeneficiary & ", Guarantor: " & Me.txtGtorDescrip
    .Update
End With

rs.Close
        CurrentDb.Execute "qryUpdateProjID_tblLC", dbFailOnError         CurrentDb.Execute "qryUpdateProjID_CSM2", dbFailOnError

        DoCmd.OpenForm "frmUpdateBU"
        Me.Refresh
    
    Exit Sub
    

EH:  'Add error handling here

    MsgBox "Error " & Err.Number & ": " & Err.Description

End Sub

Open in new window



Error3065
0
Comment
Question by:pdvsa
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +1
9 Comments
 
LVL 61

Expert Comment

by:mbizup
ID: 39756673
Temporarily remove/comment out this line to see exactly which line is failing:

     ' On Error GoTo EH

Open in new window


Click debug when you get the error message and post the line of code in your next comment.
0
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 500 total points
ID: 39756696
"Cant execute a Select Query"

Execute only works on Action queries, not Select queries.

No can do IF ... this is really a SELECT query.
CurrentDb.Execute "qryUpdateProjID_tblLC", dbFailOnError  

mx
0
 
LVL 48

Expert Comment

by:Dale Fye (Access MVP)
ID: 39756735
Actually, Joe, there were two queries on that line (way out to the right) that might be at fault.

CurrentDb.Execute "qryUpdateProjID_tblLC", dbFailOnError        
CurrentDb.Execute "qryUpdateProjID_CSM2", dbFailOnError

So, either of those queries could be the "select" query.

If the OP is anything like me, he/she was testing one of the queries and changed it to a select, and then forgot to change it back to an Update query.
0
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 

Author Comment

by:pdvsa
ID: 39756791
<he/she was testing one of the queries and changed it to a select, and then forgot to change it back to an Update query.
==>that is exactly what I did.  I now understand the importance of naming a update qry with the word Update in the name. I found 2 more I forgot to change from a select.

thank you
0
 
LVL 75
ID: 39756981
So ... then I was right ... a was my post ??
I pointed out first that you cannot Execute a select query.

ms
0
 
LVL 48

Expert Comment

by:Dale Fye (Access MVP)
ID: 39757217
pdvsa,

Agree with, Joe.  He is the one that pointed it out, I just piled on.  He should get these points.

Click "Request Attention", bottom right corner of your original post, and ask the moderators to reopen the question so that you can award points appropriately.
0
 

Author Comment

by:pdvsa
ID: 39757343
Sorry about that Joe...I requested attention
0
 
LVL 75
ID: 39757715
Details, details :-)
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question