Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Error 3065 - Cant execute a Select Query

Posted on 2014-01-04
9
Medium Priority
?
792 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 2000 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
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

610 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