Compile Error Expected End Sub Access
Contents |
be down. Please try the request again. Your cache administrator is webmaster. Generated Thu, 06 Oct 2016 00:36:41 GMT by s_hv995 (squid/3.5.20)
your question and get tips & solutions from a community of 418,469 IT Pros & Developers. It's quick & easy. error: Expected End Sub P: 44 DavidPT
Compile Error Expected End With
Hi, Im getting this error mesage, for the below code. I have tried to compile error block if without end if add END Sub at the end but still didnt work Any ideas? Expand|Select|Wrap|Line Numbers PrivateSubCommand45_Enter() FunctionupdateList() 're-createquerystuff Me.lstName.ControlSource="Form_hoursworked" Me.lstName.Requery EndFunction Mar
Can't Execute Code In Break Mode
5 '09 #1 Post Reply Share this Question 11 Replies 100+ P: 365 Dan2kx because you open with "sub" and end with "function" They should be the same, one or the other Mar 5 http://answers.microsoft.com/en-us/msoffice/forum/msoffice_access-mso_winother/compile-error-expected-end-sub/cf9624dc-6745-4745-8c7e-97503fa12327 '09 #2 reply P: 44 DavidPT Yeah i tried End Sub. So what are you suggesting Mar 5 '09 #3 reply 100+ P: 365 Dan2kx replace end function with end sub Mar 5 '09 #4 reply P: 44 DavidPT @Dan2kx Just tried this still getting the same error message Mar 5 '09 #5 reply 100+ P: 365 Dan2kx Expand|Select|Wrap|Line Numbers PrivateSubCommand45_Enter() 're-createquerystuff Me.lstName.ControlSource="Form_hoursworked" Me.lstName.Requery EndSub You tried that? https://bytes.com/topic/access/answers/865489-error-expected-end-sub or Expand|Select|Wrap|Line Numbers PrivateSubCommand45_Enter() callupdateList() EndSub Expand|Select|Wrap|Line Numbers FunctionupdateList() 're-createquerystuff Me.lstName.ControlSource="Form_hoursworked" Me.lstName.Requery EndFunction Mar 5 '09 #6 reply P: 44 DavidPT Tried all of the above didnt work. If i change the code to much i think it will effect my access form. Mar 5 '09 #7 reply 100+ P: 236 smartchap I think you may try the following code: Expand|Select|Wrap|Line Numbers PrivateSubCommand45_Enter() updateList() 're-createquerystuff Me.lstName.ControlSource="Form_hoursworked" Me.lstName.Requery EndSub where I assume that updateList() is a function defined by you somewhere else in the code. Mar 5 '09 #8 reply Expert 2.5K+ P: 3,532 missinglinq @DavidPT We're all guessing, of course, without seeing all of the pertinent code, but you've apparently Copy and Pasted a function in the middle of a sub, which you can't do! Somewhere below the code you posted I suspect you have an End Sub, possibly with code preceding it, that should be closing Sub Command45_Enter(). My advice would be to delete all the code you posted, and look for the stray, unmatched, End Sub , delete it, and start over again. Linq ;0)> Mar 5 '09 #9 reply P: 44 DavidPT Thanks for the replys this is the whole code Expand|Select|Wrap|Line Numbers PrivateSubCommand45_Click() OnErrorGoToErr_Command45_Click DoCmd.DoMenuItemacFormBar,acRecordsMenu,5,,acMenuVer70 Exit_Command45_Click: ExitSu
" Compile Error : Expected End Sub" and where it comes? If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start http://www.vbforums.com/showthread.php?736775-RESOLVED-Visual-basic-S-error-quot-Compile-Error-Expected-End-Sub-quot-and-where-it-comes viewing messages, select the forum that you want to visit from the selection below. Results 1 to 11 of 11 Thread: [RESOLVED] Visual basic'S error " Compile Error : Expected End Sub" and where it comes? Tweet Thread Tools Show Printable http://www.access-programmers.co.uk/forums/showthread.php?t=40303 Version Subscribe to this Thread… Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode Oct 2nd, 2013,07:52 AM #1 ilke View Profile View Forum Posts Thread Starter New Member Join Date Oct 2013 Posts 7 [RESOLVED] Visual basic'S error compile error " Compile Error : Expected End Sub" and where it comes? Please can someone tell me where i am making mistake? Visual basic is giving error , it is sayin " Compile Error : Expected End Sub " I am new with this program. I searched on the internet. I am using Private Sub or function wrongly i think. I put end but it still saying "End Sub". Codes: Private Sub Form_Load() Dim i As Integer Dim x(1 To 100) As Double ir compile error expected = 0 x(1) = 2: x(2) = 3: AERROR = 0.001 Public Function f(ByVal x As Double) As Double fx(i - 2) = x(i - 2) ^ 2 fx(i - 1) = x(i - 1) ^ 2 End Function End Sub Public Sub Calculate_Click() For i = 3 To 100 x(i) = x(i - 1) - ((fx(i - 1) * (x(i - 1) - x(i - 2))) / (fx(i - 1) - fx(i - 2))) If Abs(x(i) - x(i - 1)) < AERROR Then GoTo Solution ir = ir + 1 Next i Solution Print Sonuç = x(i), ir End Sub Reply With Quote Oct 2nd, 2013,08:15 AM #2 techgnome View Profile View Forum Posts PowerPoster Join Date May 2002 Posts 29,763 Re: Visual basic'S error " Compile Error : Expected End Sub" and where it comes? you're trying to put a function inside of a sub... you can't do that... also, your function as it is, doesn't return anything... further complicating it, your function uses a variable array fx that's undefined... the short of it, there's a lot more than just a "missing" end sub here... I'd try to fix it, but I don't know what it's doing, what it's supposed to do or what fx() is supposed to be... so I'm not sure where to start. -tg * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.* * I also don't respond to friend requ
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 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 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 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