Access 2007 Compile Error Expected Case
Contents |
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 access compile error expected = the company Business Learn more about hiring developers or posting ads with us Stack access vba compile error expected = Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of compile error in query expression access 2007 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Compile Error: Expected Case up vote 1 down vote favorite I have an event procedure of the form compile error expected array to Execute a series of Append query statements to create the new related records. I am getting a "Compile Error: Expected Case" the SELECT Inquiries.InquiryID of the code is red. The exact code is pasted below. Private Sub Form_AfterInsert() Dim db As DAO.Database Dim strSQL As String Set db = DBEngine(0)(0) strSQL = "INSERT INTO PreCallQuestionaireResidential ( InquiryID )" SELECT Inquiries.InquiryID FROM Inquiries db.Execute strSQL Set db = Nothing End Sub ms-access
Compile Error Expected End With
access-vba ms-access-2007 share|improve this question edited Jan 26 at 18:50 HansUp 79.1k114371 asked Jan 26 at 18:39 AJK 102 add a comment| 1 Answer 1 active oldest votes up vote 1 down vote accepted When Access sees SELECT unquoted, it expects that to be part of a Select Case code block. You want your SELECT included in the strSQL string ... strSQL = "INSERT INTO PreCallQuestionaireResidential ( InquiryID )" & vbCrLf & _ "SELECT Inquiries.InquiryID FROM Inquiries" Debug.Print strSQL '<- view this in Immediate window; Ctrl+g will take you there share|improve this answer answered Jan 26 at 18:46 HansUp 79.1k114371 Also, for better information in the event of problems, consider using the dbFailOnError option with db.Execute strSQL –HansUp Jan 26 at 18:52 It worked. Many thanks. –AJK Jan 27 at 7:48 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign up using Facebook Sign up using Email and Password Post as a guest Name Email Post as a guest Name Email discard By posting your answer, you agree to the privacy policy and terms of service. Not the answer you're looking for? Browse other questions tagged ms-access access-vba ms-access-2007 or ask your own question. asked 8 months ago
Join INTELLIGENT WORK FORUMSFOR COMPUTER PROFESSIONALS Log In Come Join Us! Are you aComputer / IT professional?Join Tek-Tips Forums! Talk With Other Members Be Notified
Compile Error Expected Identifier
Of ResponsesTo Your Posts Keyword Search One-Click Access To YourFavorite Forums Automated compile error expected identifier or bracketed expression SignaturesOn Your Posts Best Of All, It's Free! Join Us! *Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail. Posting Guidelines Promoting, selling, recruiting, coursework and thesis posting is forbidden.Tek-Tips Posting Policies Jobs Jobs from Indeed What: Where: jobs by Link http://stackoverflow.com/questions/35021319/compile-error-expected-case To This Forum! Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.Just copy and paste the BBCode HTML Markdown MediaWiki reStructuredText code below into your site. Microsoft: Access Modules (VBA Coding) Forum at Tek-Tips HomeForumsProgrammersDBMS PackagesMicrosoft: Access Modules (VBA Coding) Forum Compile Error: Expected Case thread705-1183282 Forum Search FAQs Links MVPs Compile Error: Expected http://www.tek-tips.com/viewthread.cfm?qid=1183282 Case Compile Error: Expected Case tbiceps (IS/IT--Management) (OP) 27 Jan 06 13:51 This is a line of code in an application. I get a compile error when I attempt to run this code that states the following:(Compile error:Expected Case)SELECT QryProcessOperationsArea.[Report ID], QryProcessOperationsArea.[Customized or Standard], QryProcessOperationsArea.[Report Title], QryProcessOperationsArea.[ApplicationProducing Report], QryProcessOperationsArea.[Report Type] FROM QryProcessOperationsArea;I copied this line of code from the row source of the specific form. Does anyone have any clues? RE: Compile Error: Expected Case SkipVought (Programmer) 27 Jan 06 14:17 You did not provide any VB code -- just SQL.Where is your code? Skip, Be Advised! For those this winter, caught in Arctic-like calamity, be consoled...Many are cold, but few are frozen! RE: Compile Error: Expected Case tbiceps (IS/IT--Management) (OP) 27 Jan 06 15:57 This is SQL code generated by access in the QBE window. My goal is to convert this SQL statement into a VBA readable format. However, I will insert the SQL statement in the following block code.Private Sub BeginSrchButton_Click()On Error GoTo Err_BeginSrchButton_ClickIf Combo9 = "All" ThenDoCmd.OpenForm "fReportQuerybyWMSApp", acNormal, "QryProcessOperationsAreaAll", , acFormPropertySettings, acWindowNormal"""/IDEAL
Case and Cooling Fetish CPU & Motherboard Technologia Mobile Computing Outpost Networking Matrix Other Hardware Agora Classifieds Ars DIY Forum (Name TBD!) Operating Systems & Software Battlefront Microsoft OS & http://arstechnica.com/civis/viewtopic.php?t=108545 Software Colloquium Linux Kung Fu Windows Technical Mojo Distributed Computing Arcana Macintoshian Achaia Programmer's Symposium The Server Room Ars Lykaion Gaming, Extra Strength Caplets The Lounge The Soap Box https://www.tutcity.com/access/date-function-compile-error.55918.html The Boardroom The Observatory Ars Help & Feedback Ars Subscription Member Areas Image Galleries MS Access VBA Newbie question - "Compile Error: Expected: List Separator or )" 3 posts ScruffyNerf "Very Little Gravitas compile error Indeed" Ars Tribunus Angusticlavius Tribus: Adelaide, South Australia Registered: Sep 4, 2006Posts: 8373 Posted: Sat Sep 13, 2008 6:47 am 'Evening,I've been given a task to create a MS Access db for a community support network, and have run into a small bug. As a part of this, I've created a form for data entry of new people to tblPeople. Currently, I'm attempting to get a duplicate search performing when data is entered in compile error expected the form, and am getting the above error.Please note that this is pretty much my first foray into VBA code, and the code itself was kludged together from various places on the net, including the experts-exchange site.Table details:PeopleID: Autonumber Primary KeyFamilyName (Text)PreferredName (Text)Form Details:On the 2nd tab field (PreferredName), I've created a 'BeforeUpdate' Event procedure calling the following VBA code: Private Sub PreferredName_BeforeUpdate(Cancel As Integer) Dim sWhere As String Dim lID As Long 'If both name fields have a value If Nz(FamilyName.Value, "") <> "" And Nz(PreferredName.Value, "") <> "" Then *** lID = VAL(NZ(DLOOKUP("PeopleID","tblPeople","FamilyName = '" & FamilyName.Value & "' AND PreferredName = '" & PreferredName.Value & "'),0)) *** 'see if record returned i.e., lID>0 and it if does not match current id on form then its duplicate If lID <> PeopleID.Value Then MsgBox "Possible duplicates exist. Please do a search for this name before continuing." Cancel = True End If End If End Sub The starred line is what appears to be throwing the compile error, but I have no idea as to why. What am I missing? Any help would be appreciated. Azzmodan Ars Praetorian Tribus: The Netherlands Registered: Dec 13, 2004Posts: 473 Posted: Sat Sep 13, 2008 7:20 am You didn't terminate your last string: lID = VAL ( NZ ( DLOOKUP ( "PeopleID","tblPeople","FamilyName = '" & FamilyName.
try and run it, I get a "Compile error: Can't find project or library" error. Does anyone know why I might be getting this Sponsored Links: Read full post... Report an issue Thank you for taking the time to report an issue. What's wrong... Please write below. And write your email address (optional) Similar posts... Compile Error: Method or data member not found I have a function in a standard module. When the function is called, I get an compile error 'Method or data member not found'. There is nothing wrong with the spelling of the function name when it is called. I don't get an error when I manually compile the code. I get an error on the next function in the module. If I run the function in the debugwindow I get the compile error. I've compacted and repaired the dB. I've checked the referenced modules. How to fix a Compile error in query expression Error In Access 2003/XP/2000/97, I tried using the Left function in a query and I get the following error: ("Compile error.in query expression") I've seen this function work in other Access databases. How come it does not work in mine? Compile Error sub or function not defined this is the code I have this code but keep getting this error "Compile Error sub or function not defined this is the code ' Determine reporting time frame Select Case Me.lstSalesPeriod Case ByYear strReportName = "Customer Reports" lOrderCount = DCountWrapper("*", "Order Analysis", "[Year]=" & Me.cbYear) the error is at Me.cbYear Compile Error on Environ I have a strange going on with Access security. In my Access 2007 database I have Public Function User() User = Environ("UserName") End Function Which allows name logging when data is amended. This works well for me every time, but when some colleagues open the database, it debugs to that piece of code saying Compile Error cannot find object or library Trouble assigning function return value I'm building a MS Access 2010