Ms Access Error 3067
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up append query in VBA (run-time error 3067) up vote 3 down vote favorite I'm pulling seven values from unbound text boxes on a form into variables. Five of the variables are string type, two are double. I'm then using sql to append the data to a table using a where statement and a global variable which contains a foreign key I used from another table, since I was unsure how to use openargs with browseto... Option Compare Database Private Sub Form_Load() Dim rowN, rowR, mat, crew, perCom As String Dim budEst, curBud As Double End Sub Private Sub btnCapSubmit_Click() rowN = Me.CAP_ROW_N rowR = Me.CAP_ROW_R mat = Me.CAP_MAT crew = Me.CAP_CREW perCom = Me.CAP_PER budEst = Me.CAP_BUD_EST curBud = Me.CAP_BUD_CUR Dim appendIt As String appendIt = "INSERT INTO CAPITAL " & _ "([CAPITAL].[CAP_ROW_N], CAPITAL.[CAP_ROW_R], [CAPITAL].[CAP_MAT], [CAPITAL].[CAP_CREW], [CAPITAL].[CAP_PER], [CAPITAL].[CAP_BUD_EST], [CAPITAL].[CAP_BUD_CUR]) " & _ "VALUES ('" & rowN & "','" & rowR & "','" & mat & "','" & crew & "','" & perCom & "','" & budEst & "','" & curBud & "') WHERE [PRO_ID] = '" & gblFind & "';" Debug.Print appendIt DoCmd.RunSQL appendIt DoCmd.BrowseTo acBrowseToForm, "frmSearchEdit", "NavForm.NavigationSubform", , , acFormEdit End Sub Access complains with error #3067,
Community Links Social Groups Pictures & Albums Members List Calendar Search Forums Show Threads Show Posts Tag Search Advanced Search Find All Thanked Posts Go to Page... Thread Tools Rate Thread Display Modes 11-09-2007, 06:33 PM #1 downhilljon Newly Registered User Join Date: Jun 2007 Location: Canberra, Australia Posts: 31 Thanks: 0 Thanked 0 Times in 0 Posts Append query issue - 3067 runtime error Hi there, I'm hoping someone can help me solve this one. My append code pops up with a runtime error (3067) when it gets to the DoCmd.RunSQL line. Here is the code: Code: strSQL1 = "INSERT INTO [tblCustomers] ( FirstName, Surname, Address, Suburb, State, PostCode, WorkPhone, MobilePhone )" & _ "SELECT '" & strFirstName http://stackoverflow.com/questions/27713095/append-query-in-vba-run-time-error-3067 & "' AS FirstName, '" & strSurname & "' AS Surname, '" & _ strAddress & "' AS Address, '" & strSuburb & "' AS Suburb, '" & _ strState & "' AS State, '" & strPostCode & "' AS PostCode, '" & _ strWorkPhone & "' AS WorkPhone, '" & strMobilePhone & "' AS Mobile Phone;" DoCmd.RunSQL strSQL1 I copied, pasted and modified from an existing append SQL statement, so I'm fairly certain the structure is correct, probably just missing http://www.access-programmers.co.uk/forums/showthread.php?t=138487 something small and silly! I have also tried creating the append query and copying and pasting in the resulting SQL statement Access generates, and that gave me a different problem, so I'll just concentrate on this for now. Any help is appreciated! Cheers downhilljon View Public Profile Find More Posts by downhilljon 11-10-2007, 06:43 AM #2 OlcayM Newly Registered User Join Date: Oct 2007 Posts: 47 Thanks: 1 Thanked 1 Time in 1 Post it is not this "AS Mobile Phone;" which should be "AS MobilePhone;" ? Is it? OlcayM View Public Profile Find More Posts by OlcayM 11-10-2007, 08:42 AM #3 ajetrumpet Banned Join Date: Jun 2007 Location: Universe - Local Group - Milky Way Galaxy - Orion Arm Posts: 5,640 Thanks: 0 Thanked 95 Times in 44 Posts Jon, the first thing I noticed when I looked at your query was that you have no source. Are you selecting this data from anywhere or are you just pulling it out of the air? Quote: Query input must contain at least one table or query. (Error 3067) In Microsoft Access database engine databases, this error occurs if you do not select a table name when you create a query. Select at least one table or query. In ODBCDirect databases, this error occurs if you attempt to execute a query that does not contain an SQL statement. Include
Question Need help? Post your question and get tips & solutions from https://bytes.com/topic/access/answers/208364-please-help-what-wrong-sql-code a community of 418,595 IT Pros & Developers. It's quick & http://www.accessforums.net/programming/run-time-error-3067-query-input-must-13867.html easy. Please help! What is wrong with this SQL code? P: n/a Lauren Wilson The following query runs just fine in the Access 2003 interface. strSQL = "SELECT tblCASES.CID, tblCASES.[File Number] AS [DACS FN], tblCONTACTS.FirstName, tblCONTACTS.MiddleInitial, " & _ "tblCONTACTS.LastName, tblCASES.[Firm Name], tblCONTACTS.Company, ms access tblCONTACTS.Address1, tblCONTACTS.Address2, " & _ "tblCONTACTS.City, tblCONTACTS.State, tblCONTACTS.Zip5, tblCONTACTS.Telephone, tblCONTACTS.Facsimile, " & _ "tblCASES.[File Number], tblCASES.[Case Name], tblCASES.AttorneyFName, tblCASES.AttorneyLName " & _ "INTO " & tempTbl & "" & _ "FROM tblCONTACTS INNER JOIN tblCASES ON tblCONTACTS.CID = tblCASES.CID " & _ "WHERE (((tblCASES.CID) = " & CID & ") And ((tblCASES.[File Number]) = ms access error """ & DACSfn & """));" The exact same code croaks when I attempt to run it with ... DoCmd.RunSQL strSQL I get an error that says I must select a query to run. This makes NO sense to me. I've done this a thousand times. What am I doing wrong? Thanks Nov 13 '05 #1 Post Reply Share this Question 3 Replies P: n/a Lauren Wilson The error I get is: "Runtime Error 3067 Query input must contain at least one table or query." ALL of the variables are filled properly at run time. On Tue, 31 May 2005 03:23:47 -0500, Lauren Wilson
a forum dedicated to Microsoft Access, if you want to ask any Access related questions or help other members out, please join our community, the registration is free and takes only one minute. Page 1 of 338 123456789101151101 ... Last Jump to page: Threads 1 to 25 of 8429 Forum: Programming Access programming discussion. Forum Tools Mark This Forum Read View Parent Forum Search Forum Show Threads Show Posts Advanced Search Threads in This Forum Title / Thread Starter Replies / Views Last Post By Apply Filter to Subform on Main Unbound Form StuW Replies: 2 Views: 65 Rating0 / 5 Last Post By StuW View Profile View Forum Posts Today, 09:02 AM Monitoring of data entry in a field tonycl69 Replies: 7 Views: 53 Rating0 / 5 Last Post By tonycl69 View Profile View Forum Posts Today, 06:06 AM Excel formula to access vba. tonycl69 Replies: 2 Views: 32 Rating0 / 5 Last Post By tonycl69 View Profile View Forum Posts Today, 05:36 AM Developing a calendar docpanderson Replies: 14 Views: 1,031 Rating0 / 5 Last Post By tonycl69 View Profile View Forum Posts Yesterday, 11:22 PM How can I calculate working days between two dates? lleeman Replies: 9 Views: 374 Rating0 / 5 Last Post By tonycl69 View Profile View Forum Posts Yesterday, 11:09 PM Open form for new record and add value to text box Crossdr Replies: 5 Views: 71 Rating0 / 5 Last Post By pbaldy View Profile View Forum Posts Yesterday, 03:36 PM Writing to a record twice Thompyt Replies: 6 Views: 111 Rating0 / 5 Last Post By Thompyt View Profile View Forum Posts Yesterday, 11:00 AM On Current Event Question JeRz Replies: 2 Views: 60 Rating0 / 5 Last Post By aytee111 View Profile View Forum Posts Yesterday, 08:41 AM DoCmd.OpenForm with 2 Where Conditions CharissaBelle Replies: 3 Views: 67 Rating0 / 5 Last Post By pbaldy View Profile View Forum Posts Yesterday, 08:32 AM Data Type Mismatch on Criteria Expression Mikejsinclair Replies: 3 Views: 66 Rating0 / 5 Last Post By Mikejsinclair View Profile View Forum Posts Yesterday, 02:37 AM text box custom currency fomat not working dickn Replies: 2 Views: 112 Rating0 / 5 Last Post By dickn View Profile View Forum Posts 10-18-2016, 10:28 PM Popup Form Reference Thompyt Replies: 4 Views: 78 Rating0 / 5 Last Post By Thompyt View Profile View Forum Posts 10-18-2016, 05:55 PM Need help with fso.copyfile NightWalker Replies: 8 Views: 101 Rating0 / 5 Last Post By aytee111 View Profile View Forum Posts 10-18-2016, 09:26 AM Runtime Error 3251 object not supported avanduyvenbode Replies: