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
Solved

Error 3065 - Cant execute a Select Query

Posted on 2014-01-04
9
685 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
  • 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 47

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
Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

 

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 47

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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
On Key Down Access 2010 6 41
table joins in qry 17 61
Access 2010 get Name of local computer from Terminal server 19 49
Access Schema 6 25
This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

856 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