Microsoft Access 2010 There Was An Error Compiling This Function
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 company Business Learn more about hiring developers or posting ads with us Stack Overflow
There Was An Error Compiling This Function The Visual Basic Module
Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow compile error in query expression access 2010 is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Access database functions up access 2016 compile error in query expression vote 0 down vote favorite I created a database at work on Access 2010 with queries using the left(),right() and mid() functions. I then copied the database over to my pc at home, but now these functions does not want to work on
The Visual Basic Module Contains A Syntax Error
this database. My pc at home also has Access 2010. Everytime i try to run a query i get the following message, There was an error compiling this function. Visual basic contains a syntax error. Check the code and then compile it again. I created a new DB on my pc at home to test the functions and had no problems. I also noticed that on my pc at home the heading reads Database1 : Database(Access 2007) - Microsoft Access while at work it says Database1 :
Access 2010 The Visual Basic Module Contains A Syntax Error
Database(Access 2007 - 2010) - Microsoft Access. Both PCs have Windows 7 Professional and my home PC is about 1 year old and my pc at work about 3 months. I also updated/repaired my Access at home, but the DB still does not want to work. How can i fix this problem? I have a simple table call it Table1 with an id column and a column named Name, id Name 1 Jason 2 Casey 3 Shasha Now if i want to use the left() function in an Access query , i get the error message: There was an error compiling this function. Visual basic contains a syntax error. Check the code and then compile it again. Query: Select Left([Name],2) As Short_name From Table1 ms-access share|improve this question edited Dec 7 '14 at 7:16 asked Dec 6 '14 at 6:24 Jason Samuels 331621 We need to see the relevant portion of your program's source code before we can help you. –Dai Dec 6 '14 at 6:44 Did you get your code working? If not, try running this little query: SELECT Left("Jason",2); without any AS or FROM. You should get one record consisting of "Ja". Also try typing this in the debug window: ?left("Jason",2) and you should get "Ja". If they both fail, then your db from work may be redefining the Left function. –Tom Robinson Dec 19 '14 at 18:56 add a comment| 1 Answer 1 active oldest votes up vote 2 down vote You want while in the VBA editor go tools->references, and look
be down. Please try the request again. Your cache administrator is webmaster. Generated Thu, 20 Oct 2016 15:40:10 GMT by s_wx1126 (squid/3.5.20)
Access 2010 Page 1 of 1 New Topic/Question Reply 6 Replies - 10039 Views - Last Post: 28 December 2012 - 03:39 PM #1 VIPER5646 http://www.dreamincode.net/forums/topic/305059-compile-error-when-running-a-function-in-access-2010/ D.I.C Head Reputation: 1 Posts: 92 Joined: 01-March 09 Compile error when running a Function in Access 2010 Posted 28 December 2012 - 10:09 AM The following function works https://answers.yahoo.com/question/index?qid=20120312165444AAOlKJl well in VS2010. Then I rewrote it in access but every time I call it I get a Compile error in the first line. Your help would be appreciated. compile error Public Function GetBusinessDayDifference(ByVal date1 As Date, ByVal date2 As Date) As Integer Dim startDate As Date = If(date1 < date2, date1, date2) Dim endDate As Date = If(date1 > date2, date1, date2) Dim difference As TimeSpan = endDate - startDate Dim totalDays As Integer = difference.Days Dim weeks As Integer = totalDays \ 7 Dim days As Integer = totalDays the visual basic Mod 7 Dim businessDays As Integer = weeks * 5 For offset As Integer = 1 To days Select Case startDate.AddDays(offset).DayOfWeek Case DayOfWeek.Monday, _ DayOfWeek.Tuesday, _ DayOfWeek.Wednesday, _ DayOfWeek.Thursday, _ DayOfWeek.Friday businessDays += 1 End Select Next Return businessDays End Function This is the query I'm Using to call the function SELECT TBDfilter_qry.ID, TBDfilter_qry.Date, TBDfilter_qry.Order_Entry, TBDfilter_qry.Adress, TBDfilter_qry.City, TBDfilter_qry.Civic, TBDfilter_qry.tobeMeasured, TBDfilter_qry.tobeDesign, TBDfilter_qry.DEsign AS Design, TBDfilter_qry.Hold, TBDfilter_qry.Closing AS Closing, Status_Diff_tbl.Design, GetBusinessDayDifference(Now(),[TBDfilter_qry].[tobeDesign]) AS Dif FROM TBDfilter_qry, Status_Diff_tbl; This post has been edited by VIPER5646: 28 December 2012 - 10:19 AM Is This A Good Question/Topic? 0 Back to top MultiQuote Quote + Reply Replies To: Compile error when running a Function in Access 2010 #2 macosxnerd101 Games, Graphs, and Auctions Reputation: 12002 Posts: 44,829 Joined: 27-December 08 Re: Compile error when running a Function in Access 2010 Posted 28 December 2012 - 10:28 AM Please post your specific errors. Was This Post Helpful? 0 Back to top MultiQuote Quote + Reply #3 andrewsw don't rely on secrecy Reputation: 5961 Posts: 23,469 Joined: 12-December 12 Re: Compile err
Help Suggestions Send Feedback Answers Home All Categories Arts & Humanities Beauty & Style Business & Finance Cars & Transportation Computers & Internet Consumer Electronics Dining Out Education & Reference Entertainment & Music Environment Family & Relationships Food & Drink Games & Recreation Health Home & Garden Local Businesses News & Events Pets Politics & Government Pregnancy & Parenting Science & Mathematics Social Science Society & Culture Sports Travel Yahoo Products International Argentina Australia Brazil Canada France Germany India Indonesia Italy Malaysia Mexico New Zealand Philippines Quebec Singapore Taiwan Hong Kong Spain Thailand UK & Ireland Vietnam Espanol About About Answers Community Guidelines Leaderboard Knowledge Partners Points & Levels Blog Safety Tips Computers & Internet Software Next Opening an access 2003 file in 2010 Brings back a syntax Error? Hi there, Recently in the office our old computers have been running slow, and we have been thinking about updating all our computers. In the process update all of our Microsoft office programs to 2010. However in doing so We are afraid there may be some compatibility issues once we upload all the new software.... show more Hi there, Recently in the office our old computers have been running slow, and we have been thinking about updating all our computers. In the process update all of our Microsoft office programs to 2010. However in doing so We are afraid there may be some compatibility issues once we upload all the new software. We currently use this access 2003 file to access our database with but once I tried it on A computer i had at home that had access 2010 it returned with this error "There was an error compiling this function. The visual basic module contains a Syntax error, Check the code then recompile it." Once i click "Ok" It brings up "Macro single step" then it says "Macro Name: AutoExec" Then "Action Name:RunCode" then "Arguments:SystemStartUp()" and finally the error Code "7960" So any help on this issue would be fantastic. We just want to know if this is an easy fix and if we can just change a little thing around and it will all work on the new 2010 when we update our computers or not. Thanks in Advance, Regards, J