Compile Error Duplicate Option Statement
Search Community Links 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-07-2002, 08:17 AM #1 MrTibbs Registered User Join Date: Oct 2001 Posts: 101 Thanks: 0 Thanked 0 Times in 0 Posts removing a Duplicate Option Statement error Opening a form which had an 'On Open' Event Procedure reveals error: "The expression On Open you entered as the event property setting produced the following error: Duplicate Option Statement" If I remove the open event the error appears on the load event, if I remove both open and load the error occurs the first time I try and excute any of the action buttons. I've scoured the code and found nothing untoward .. any ideas? MrTibbs View Public Profile Find More Posts by MrTibbs 01-07-2002, 08:19 AM #2 chrismcbride Senior Member Join Date: Sep 2000 Location: Ottawa, Ontario, Canada Posts: 301 Thanks: 0 Thanked 1 Time in 1 Post Something wierd in the General Declarations??? Chris chrismcbride View Public Profile Find More Posts by chrismcbride 01-07-2002, 08:23 AM #3 MrTibbs Registered User Join Date: Oct 2001 Posts: 101 Thanks: 0 Thanked 0 Times in 0 Posts Nope .. I found it 15 seconds after posting the question ... maybe I should post sooner!? I had 3 modules, one un-used, which had Option Explicit listed twice. Removed that and the error went away! MrTibbs View Public Profile Find More Posts by MrTibbs « Previous Thread | Next Thread » Thread Tools Show Printable Version Email this Page Display Modes Linear Mode Switch to Hybrid Mode Switch to Threaded Mode Rate This Thread Excellent Good Average Bad Terrible Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home Access World Access World News Site Suggestions Introduce Yourself The Watercooler Microsoft Access Discussion General Tab
for the Activate event of a form. I create the Activate event as usual. It looks like this: Private Sub Form_Activate() End Sub As you can see, there's nothing in the event yet. When I try to open the form, I get the following message: The expression On Activate you entered as the event property setting produced the following error: Duplicate Option statement. * The expression may not result in the name of a macro, the name of a user-defined fuction, or [Event Procedure]. * There may have been an error evaluating the function, event or macro. If I delete the above code, the form opens normally. The same error occurs, with slightly different wording, when I try to code FormOpen or FormLoad events instead of FormActivate. I http://www.access-programmers.co.uk/forums/showthread.php?t=27647 have tried moving all code and objects to a new form -- the same thing happens. I have tried repairing and compacting -- the same thing happens. I have tried opening a new database and moving all code and objects -- no dice. Any ideas? TIA!! -- Carol Guest, Jun 28, 2005 #1 Advertisements Andrew Backer Guest What does the property sheet for the form look like? Does it say [Event Procedure], or do you yave an =[subname] or something else in there? It http://www.pcreview.co.uk/threads/duplicate-option-statement.1894987/ says 'duplicate option statement', so what do you have at the top of the code behind? Look for something like : Option Compare Database Option Compare Database or Option Explicit Option Explicit Not in Andrew Backer, Jun 28, 2005 #2 Advertisements Guest Guest The property sheet just says [Event Procedure]. There are no duplicates, as far as I can see, and I've looked very hard. No duplicate procedure names, no duplicate labels, no duplicate objects of any kind. -- Carol "Andrew Backer" wrote: > What does the property sheet for the form look like? Does it say > [Event Procedure], or do you yave an =[subname] or something else in > there? > > It says 'duplicate option statement', so what do you have at the top of > the code behind? Look for something like : > > Option Compare Database > Option Compare Database > > or > Option Explicit > Option Explicit > > Not in > > Guest, Jun 28, 2005 #3 Andrew Backer Guest Is there a lot of code that is sensitive on the page? If not, could you paste the code-behind of that form? What happens if you try to compile the database (in vb view "debug->compile"), and also what happens if you put some code in the procedure, like a messagebox. -- andrew Andrew Backer, Jun 28, 2005 #4 Guest Guest Here it is; thanks for your help! ----------------------------------------------------------- Option Compare Database Private sub Form_Activate() End Sub Private Sub cmbRp
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 Of ResponsesTo Your Posts Keyword Search http://www.tek-tips.com/viewthread.cfm?qid=1092327 One-Click Access To YourFavorite Forums Automated 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 To This Forum! Add Stickiness To Your Site By Linking To This compile error 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 Export to Excel w/ VBA thread705-1092327 Forum Search FAQs Links MVPs Export to Excel w/ VBA Export to Excel w/ VBA mca2k4 (Programmer) (OP) 14 Jul 05 14:39 I currently have compile error duplicate a listbox where selected entries are exported to a brand-NEW Excel worksheet (each time) after the user clicks a command button to run the following VBA code. However, I'd like it to create just ONE new Excel worksheet initially and then append later selections onto that same spreadsheet. What changes would I need to make to the code for this to happen?Private Sub shootoutexcel_Click()On Error GoTo err_handlerDim x As Integer, y As IntegerDim itm As VariantDim xlNew As Excel.ApplicationDim shtSet xlNew = GetObject(, "Excel.Application")If TypeName(xlNew) = "Nothing" ThenSet xlNew = CreateObject("Excel.Application")End If'Set xlNew = CreateObject("Excel.application")With xlNew.Workbooks.Add.Sheets.AddFor Each itm In Me.lstCustInfo.ItemsSelectedx = x + 1For y = 1 To Me.lstCustInfo.ColumnCount - 1.Sheets(1).Cells(x, y) = Me.lstCustInfo.Column(y, itm)NextNextEnd WithxlNew.Visible = TrueExit Suberr_handler:If Err.Number = 429 ThenResume NextElseMsgBox Err.Number & " " & Err.Description, vbOKOnly, "Error"End IfEnd Sub RE: Export to Excel w/ VBA PHV (MIS) 14 Jul 05 14:43 In the VBA Visual Basic for Applications (Microsoft) forum707 FAQ area you'll find code to retrieve the last used row of a worksheet. Hope This Helps, PH.Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886 RE: Export to Excel w/ VBA m