Compile Error Expected = Vba
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 the
Vba Compile Error Can Find Project Or Library
company Business Learn more about hiring developers or posting ads with us Stack Overflow vba compile error expected expression Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7
Vba Compile Error Expected End Of Statement
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 vba expected = when calling sub as below Public Sub updateStagesTable(sName As String, percentageValue As Double) stageName = "'" & sName & "'" sSQL = "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 compile error expected = msgbox 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.7k74163 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|improve this answer edited Aug 4 at 9:21 Gareth 2,68821144 answered Jul 24 '15 at 11:00 PeterTaylorXC 111 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 vba access-vba or ask your own question. asked 1 year ago viewed 3084 times active 2 months ago Blog Stack Overflow Podcast #89 - The Decl
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
Vba Compile Error Expected Function Or Variable
developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask vba compile error byref argument type mismatch Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join
Access Vba Compile Error Expected
them; it only takes a minute: Sign up vba 'Compiler error expected: =' on saveAs operation up vote 4 down vote favorite 1 The following line in my VBA code is generating the compile error 'Compiler error expected: =' http://stackoverflow.com/questions/31329829/ms-access-vba-compile-error-expected implying that it expected an assignment. What am I doing wrong and how do I fix this? I just want to save the file. Also, I want to overwrite the file which was previously a .xls or .xlsx file. Will this line do that? Workbooks(theFile).SaveAs("Z:\test\vhb\" & newName, xlCSV) excel vba compiler-errors save-as share|improve this question edited Mar 9 '14 at 16:36 Simon Adcock 2,97131635 asked Feb 10 '12 at 15:41 Brian 41861225 add a comment| 1 Answer 1 active http://stackoverflow.com/questions/9230381/vba-compiler-error-expected-on-saveas-operation oldest votes up vote 13 down vote accepted You do not use parentheses unless you are assigning to a variable. Workbooks(theFile).SaveAs "Z:\test\vhb\" & newName, xlCSV share|improve this answer answered Feb 10 '12 at 15:49 Fionnuala 77k665110 Thanks, it didn't make sense to me to assign my saving. –Brian Feb 10 '12 at 16:07 4 @Brian if you really want to use the parentheses you can use Call: Call Workbooks(theFile).SaveAs("Z:\test\vhb\" & newName, xlCSV) -- but I have to say I really don't like this approach, because it adds nothing other than verbosity. –phoog Feb 10 '12 at 18:20 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 excel vba compiler-errors save-as or ask your own question. asked 4 years ago viewed 18052 times active 2 years ago Blog Stack Overflow Podcast #89 - The Decline of Stack Overflow Has Been Greatly… Related 1VBA Error: “Compile error: Expected End Sub”1EXCEL VBA Error: “Compile Error: Expected Array”1SaveAs command does not work, but SaveCopyAs does0Formatting errors when SavingAs text files from worksheets0SaveAs Not Executing because a Variable value changes0Metho
Social Groups Pictures & Albums Members List Calendar Search Forums Show Threads Show Posts Tag Search Advanced Search Find All Thanked Posts http://www.access-programmers.co.uk/forums/showthread.php?t=40303 Go to Page... Thread Tools Rate Thread Display Modes 01-14-2003, 10:04 AM #1 MaxNEMC Guest Posts: n/a Compile Error: Expected: = I wrote a function that I want to have 3 parameters for Import_Reports(tblName as String, Specs as String, InputDir as String) When i try to run it, i get: Compile Error: Expected = BUT compile error If i define 2 of the parameters within the function as vars, leaving only one as an argument, it works fine. I can use any one of the 3 alone as an argument and it works, but any more than 1 and i get that compile error... i'm stumped! Any help would be greatly appreciated! Max compile error expected 01-14-2003, 10:49 AM #2 Fornatian Dim Person Join Date: Aug 2000 Location: England Posts: 1,396 Thanks: 0 Thanked 0 Times in 0 Posts Max, A compile error of this nature means that a variable is missing an assignment somewhere. Can you post your code? Also, can you elaborate on.. Quote: If i define 2 of the parameters within the function as vars, leaving only one as an argument... __________________ Ian build a better system and they'll build a better idiot. Fornatian View Public Profile Find More Posts by Fornatian 01-14-2003, 10:58 AM #3 MaxNEMC Guest Posts: n/a Function Import_Reports(Specs As String, tblName As String, InputDir as string) Dim ImportFile, ImportErrors As String 'Dummy As Integer 'InputDir = "c:\windows\desktop\adhocrpts\" 'Specs = "Highland Import Specs" ImportFile = Dir(InputDir & "\*.txt") 'Sets the Filename to be imported Do While Len(ImportFile) > 0 'tblName = Left(ImportFile, (InStr(1, ImportFile, ".") - 1)) 'This is to import each file into individual tables 'tblName = "Highland_Raw" DoCmd.TransferText acImportFixed, Specs, tblName, InputDir & ImportFile, Fal