Access 2007 Compile Error Expected
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might access compile error expected = have Meta Discuss the workings and policies of this site
Access Vba Compile Error Expected =
About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting compile error in query expression access 2007 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 4.7 compile error expected array million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up ms access - vba: Compile Error: expected: = up vote 1 down vote favorite 1 I have a subroutine as below Public Sub updateStagesTable(sName As String, percentageValue As Double) stageName = "'" & sName & "'" sSQL =
Compile Error Expected End With
"INSERT INTO StagesT ([Stage Name], [Stage Value In Percentage]) VALUES (" & stageName & "," & percentageValue & ");" DoCmd.SetWarnings False DoCmd.RunSQL sSQL End Sub and I call it from another subroutine as below economy = 3.53 updateStagesTable ("Economy", economy) But I get this compile error Compile Error: expected: = I don't understand what I am doing wrong here. Please help. vba access-vba share|improve this question asked Jul 9 '15 at 23:08 user1670773 373215 add a comment| 2 Answers 2 active oldest votes up vote 6 down vote accepted updateStagesTable ("Economy", economy) should be updateStagesTable "Economy", economy with no parentheses See related: Unexpected results from typename share|improve this answer answered Jul 9 '15 at 23:27 Tim Williams 56.5k74163 add a comment| up vote 1 down vote I have never liked this peculiarity of VB so I always use the alternate CALL syntax, in your case this would be: Call updateStagesTable("Economy", economy) which does allow the parentheses that all other languages expect share|impr
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 & Software Colloquium compile error expected identifier Linux Kung Fu Windows Technical Mojo Distributed Computing Arcana Macintoshian Achaia compile error expected identifier or bracketed expression Programmer's Symposium The Server Room Ars Lykaion Gaming, Extra Strength Caplets The Lounge The Soap Box The Boardroom
Compile Error Expected Case
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 Indeed" Ars Tribunus Angusticlavius Tribus: http://stackoverflow.com/questions/31329829/ms-access-vba-compile-error-expected 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 the form, and am getting the above error.Please http://arstechnica.com/civis/viewtopic.php?t=108545 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.Value & "' AND PreferredName = '" & PreferredName.Value & "' <--- Lacks a closing "
Visual Basic Question 0 Sign in to vote Hello: i'm making a VB 6.0 project to copy files to WCE 5.0 Device. i https://social.msdn.microsoft.com/Forums/vstudio/en-US/2f2e8361-c26f-4870-b6ab-44401f99222c/identifier-expected?forum=vbgeneral copied a code i found in msdn but when trying to compile it send me an error: Expected: Identifier http://support.microsoft.com/default.aspx/kb/307256 Private Declare Function WaitForSingleObject Lib "kernel32" ( ByVal _ hHandle As Long https://bytes.com/topic/visual-basic/answers/629707-sql-vba-getting-compile-error-expected-case ByVal dwMilliseconds As Long) As Long anybody have an idea what could be...??? Tuesday, December 19, 2006 7:35 AM Reply | Quote Answers 0 Sign in to vote Vb_2007, When compile error you see the Expected: Identifier Error message, it means that you use the reserved words in Visual Basic and it is forbidden to use the reserved words as the name of consts or variables. According to your description, I suggest you to follow the steps as the KB articles tells you. After you finished implementing this example, just copy and paste some compile error expected certain code but pay more attention to the names of the variables you use in your project. Pay more attention to the edition of your IDE, too. This forum is just about to support the Visual Basic .NET. If you have any other problems on Visual Basic 6 from now on, please post your question on the right forums in order to get better answers. In a word, thank you for your question! Thursday, December 21, 2006 7:33 AM Reply | Quote All replies 0 Sign in to vote It's hard to tell but is there a space between the underscore and hHandle ? Tuesday, December 19, 2006 9:41 AM Reply | Quote 0 Sign in to vote Vb_2007, When you see the Expected: Identifier Error message, it means that you use the reserved words in Visual Basic and it is forbidden to use the reserved words as the name of consts or variables. According to your description, I suggest you to follow the steps as the KB articles tells you. After you finished implementing this example, just copy and paste some certain
Question Need help? Post your question and get tips & solutions from a community of 418,417 IT Pros & Developers. It's quick & easy. SQL In VBA getting Compile Error: Expected Case 100+ P: 171 iheartvba Hi Everyone, I keep on getting an error saying Compile Error: Expected Case in my (MS Access) VBA What I was trying to do was to do a DSUM function for a Table where the criteria was coming from another table, I later found the criteria needs to be from within the domain table I had set DSUM function (makes sense). I then when to Query Bulder to Build The SQL string as Below and put it in VBA Expand|Select|Wrap|Line Numbers PrivateSubtbTotalColl_AfterUpdate() 'ThisshouldgettheSumofAllthetblCollections.Amtfiguresgroupedby 'tblJobDetails.TFN,tblJobDetails.RcptIDisthe1side&tblCollections.RcptID 'istheMANYsideofthetablesrelationship SELECTtblJobDetails.TFN,SumtblCollections.AmtASSumOfAmt_ &FROMtblJobDetailsINNERJOINtblCollectionsONtblJobDetails.RcptID= tblCollections.RcptID_ &GROUPBYtblJobDetails.TFN_ &HAVINGtblJobDetails.TFN=frmPinkCardsMAIN.cboFullNameOr tblJobDetails.TFN EndSub Thanks Apr 8 '07 #1 Post Reply Share this Question 5 Replies Expert 100+ P: 1,017 iburyak Try this: [PHP]SELECT tblJobDetails.TFN, Sum(tblCollections.Amt) AS SumOfAmt _ & FROM tblJobDetails INNER JOIN tblCollections ON tblJobDetails.RcptID = tblCollections.RcptID _ & WHERE tblJobDetails.TFN = frmPinkCardsMAIN.cboFullName _ & GROUP BY tblJobDetails.TFN [/PHP] Hope it helps. Apr 8 '07 #2 reply Expert 5K+ P: 8,435 Killer42 The problem is nothing to do with the SQL syntax. It is the fact that you have simply typed SQL into your VBA module. You can't do that. Your VBA code will need to place that SQL statement in a string, and then execute it in some way. Or place it in the appropriate property to have the desired effect - perhaps a form's Filter or RecordSource property, or some such. The error you are receiving indicates that your