Solved

Error 3065 - Cant execute a Select Query

Posted on 2014-01-04
9
625 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 - Access MVP) 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
 

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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

743 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now