Function Called Via Auto-exec Fails When Using Access 2007 Runtime
Jan 8, 2013
I am making my very first tentative steps to convert my most complex Access 2003 app to run under Access 2007. There are no obvious problems when simply opening my original MDB file in Access 2007 or running it after conversion to an ACCDB file. However, when I try to run the ACCDB file under the Access 2007 Runtime I get a "You can't carry out this action at the present time..." error. This is then followed by the "Execution of this application has stopped due to a runtime error..."
To be more specific, I only get that error when I deliberately hide the back end database and thus invoke code triggered via Autoexec to allow the user to browse for the missing database. This code works fine when running under normal Access 2007 so it appears to be a Runtime issue.
I installed Office Enterprise 2007. Then I installed DEveloper Exrtensions, then Access Runtime 2007. All appear to have installed OK - they appear in Program and Features. Instructions on runtime packaging tell me that a Developer option should appear in the resulting drop-down when I click the Office button (top-left round thing) when I have a d/b open in Access. It's not there! I have un-installed and re-installed the extensions and the runtime - still nothing! Help! I do have Runtime 2002 (XP) on the same PC, is that relevant?
I can manually stop the AutoExec macro from running by holding down the shift button - how do you do it by VBA? I'm opening the db from Excel, and I don't want the Switchboard to display ...
I am using Access 2010 on Windows XP/Windows 7 My code converts individual lines of address (strings) into a single RTF Address field. It runs fine in full access but (as MS admits) CreateObject does not work in Runtime. Is there another way of doing this that avoids CreateObject??
'create AddressFull strAddressFull = "" If Nz(mAddress1, "") <> "" Then strAddressFull = mAddress1 If Nz(mAddress2, "") <> "" Then strAddressFull = strAddressFull & Chr(10) & mAddress2
According to Clint Covington, Microsoft intends to release the runtime and developer extensions for free.
My opinion is that it should ALWAYS have been free instead of slapping us Access developers with an extra cost so our users don't need to pay hundreds of dollars more to use our applications. I can't think of ANY other development environment that has this drawback.
-------------------- Jeff Conrad - Access Junkie - MVP Alumni SDET - XAS Services - Microsoft Corporation
Co-author - Microsoft Office Access 2007 Inside Out Presenter - Microsoft Access 2007 Essentials http://www.accessmvp.com/JConrad/accessjunkie.html Access 2007 Info: http://www.AccessJunkie.com
---------- This posting is provided "AS IS" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified at http://www.microsoft.com/info/cpyright.mspx ----------
I have installed Microsoft Access 2003 and Microsoft Access 2003 Developer Extensions. I can create Access application by using the Package Wizard. But after I upgrade from Microsoft Access 2003 to Microsoft Access 2007. I can't use the Package Wizard.
How in the world do I add a trusted location with only the Runtime version of Access 2007 installed on the PC?
I am in the process of distributing some new runtime-only applications; how do I stop the irritating "potential security risk" warning from coming up everytime the user logs in??? I can't figure out how to get to the "trust center" with only Access Runtime installed. Users don't have any other 2007 applications like Word or Excel either, and are running Windows XP, NOT Vista.
I am having a problem running Access 2007 runtime on a workstation. I have set up the 2007 database (.accdb) on our server and am able to connect to it and open it from the pc that has Access 2007 full version installed and it works fine.
I also installed Access 2007 runtime on another PC and was able to open the database using the runtime version just fine.
However, on this other PC, I installed the runtime version, and when I use the command line (msaccess.exe /runtime \serverdirectorydatabase.accdb) to open the database in runtime mode, Access opens for a split second and then closes immediately.
When I just run msaccess.exe, it opens the runtime version and says that I have not specified a database, as expected. So, I am wondering why it is not opening the database when i DO specifiy the database.
If i specify an incorrect directory for the database, it opens the runtime version and a dialog appears telling me that a database was not found, and upon clicking OK, the program closes.
I can say, that when I run it off the computer that works through the runtime version, I get a security warning telling me that there are potentially unsafe elements in the database, but i just have to click OPEN and it still opens it fine.
Perhaps the non-working PC is denying it access due to these security issues?
I can't seem to figure this out, and any help is appreciated.
This module is giving me the "undefined function" error message when I try to run my query. I don't know why, but I have checked that there are no references with "missing" and there are not. I also added the word "Public" to the function becasue that was advised by another forum user. I thought it worked perfectly the first time I ran this query, but now it is not working and I do not recall making any changes. I have called the module basFunctions:
Option Compare Database '************************************************* ********* 'Declarations section of the module '************************************************* ********* Option Explicit '================================================= ========= ' The DateAddW() function provides a workday substitute ' for DateAdd("w", number, date). This function performs ' error checking and ignores fractional Interval values. '================================================= ========= Public Function DateAddW(ByVal TheDate, ByVal Interval) Dim Weeks As Long, OddDays As Long, Temp As String
I know its not possible. But Just wanted to confirm. Not at all possible?
Code:
Function PreImport(BookToImport As Workbook) For Each cell In BookToImport.Sheets(1).Rows(1).Cells cell.Value = Trim(cell.Value) Next cell BookToImport.Sheets(1).UsedRange.Rows(1).Replace ".", "_" End Function
I am working on Access2007. I designed a report that I need to email every night automatically to my client. The report resides in the Access database. I currently use a macro to auto email this report for me but it still requires me to double click the macro to make it run. I actually want the report to be email at night without having me running the macro manually. Is there any way to make this happen?
So I have created this database for a lessons learnt system. Is it possible in Access 2007 to create a button that if pressed automatically sends an email out to someone? So my main form in the database is a split form which contains a search filter, which works well and also contains a button called add new lesson. This button is linked into another form and when pressed brings up this new form. In this form it has a save and close button. What I actually would like is when the form is updated and this save and close button is pressed, an email is sent to a "project head" who has to confirms the information before the data is saved into the database. Is this actually possible?
I am struggling trying to execute a function inside a Form_current event to display some stats.
The Function is this:
Code: Function FlightsByAircraft(Aircraft As Long) As Long Dim rst As DAO.Recordset Dim dbs As DAO.Database Dim str As String str = "SELECT * FROM tblFlights WHERE AircraftID = " & Aircraft
[Code] ....
The code for the Form_Current event is this:
Private Sub Form_Current() txtStats1 = FlightsByAircraft(Me.AircraftID)
Very simple. Well, the problem is when I move to a new record, a error message comes up: "Run-time error '94' - Invalid use of Null". It is because the AircraftID is not populated at that time. I tried to insert in the function code something like that:
Code: If IsNull(Aircraft) then exit function else .... (the DAO.Recordset code)
I understand right off the bat if you're reaction is "don't duplicate data!!" -- mine would be too (don't fret, I know my normalization).
I've linked a table in my db to my Global Address Book in Outlook 2007 and, upon entering an employee number as a new record, would like to verify that the number entered is listed in the GAL and then pull in the associated name and location info.
The key is that I don't want this info to rely on the GAL going forward. For example, if an employee leaves or is no longer listed in the GAL, I don't want to lose the employee info (past data is needed for audit purposes). Note: I will be creating a report later to show if there are discrepancies between the GAL and my table, but that's another story...
So, what would be the best auto-fill options in Access 2007?
My company recently upgraded our MS Office from 2007 to 2010 (except for Access).
Previously, when I had Access 2007 and Outlook 2007, I had a process that generated 50+ dynamic emails from an Outlook template file (.oft).
The code would loop through a listbox and replace the template's default text to a string of text specific to the selection in the listbox by utilizing the Replace() function on the MailItem .HTMLBody.
Since the upgrade to Outlook 2010, the code is able to run, however, the Replace() function is no longer working; Instead, each email that is generated maintains the template's default text.
The only thing that is not working is the Replace() function, all other aspects of the code work fine.
I've provided a simplified version of the code below:
Dim myOlApp As Outlook.Application Dim objMailMessage As MailItem Dim stBody As String Set myOlApp = Outlook.Application Set objMailMessage = myOlApp.CreateItemFromTemplate("C:UsersDesktop emplate.oft")
[Code] .....
I've recreated the template file in Outlook 2010, thinking that the template created with Outlook 2007 would be the culprit, but to no avail.
What could have changed from Outlook 2007 to Outlook 2010 that would render my previously valid code ineffective?
Are there certain references I need to enable in both Access and Outlook to allow VBA in Access modify the content in an Outlook email?
I was hoping all the errors had been addressed in the current Runtime release..... But no. If you have a previous version of Access ...2002 for example... And load the 2007 Runtime, your applications developed in 2002 will run fine in 2007 runtime. BUT.... If you open them in 2002 you receive many errors. "onClick" errors that don't exist. So if you do not have the full version of 2007 on the computer you would need to uninstall the runtime to be able to make any changes in your app.In short.... your going to screw up anyones ability to work with a previous version if you install 2007 runtime.I will try this on another computer with Access 2003 to see if it gives the same errors after runtime install. I'll post results.OK.... After trying the Runtime on another computer with Access 2003 it appears to be OK. The problem still persist with Access XP (2002). They simply do not play well together. I guess Microsoft did not feel this was important enough of a problem to address. So, if you load a Runtime of 2007 on a machine running Access 2002 you will no longer be able to use 2002.
I have packaged a 2007 db on a 2003 server. The db contains autoexec macro which: a. opens a query, b. opens a form with cmd button that returns a msgbox c. Runcode a function that calls a subroutine to return a msgbox.
Everything runs fine on server since that's where the real 2007 install is.
On my pc I have xp2 and one install of access 97( don't ask) along with office 2003 installs(excel etc, etc).
I installed access 2007 runtime on my pc.
I copied the package from the server to my pc and did install. When db finally opens the query runs, the form opens but fails on the runcode. The code behind the cmd button returns nothing. This tells me that on vb was included with the db when it was packaged or I don't have rights to run it? Either why how can I resolve this issue as info on subject is nill.
I'm having to recode some old MS Access DBs so they will run in the following environments:
Office 2000 on WinXP Office 2003 on WinXP Office 2010 on WinXP Office 2000 on Win7 Office 2003 on Win7 Office 2010 on Win7
When I wrote my code for Office 2000 on WinXP things were simple because directory paths were the same across all computers and I could hard code pathing when using a shell command to launch other files.
My new approach is to make a function call to the Windows registry to determine the default executable and path for opening a file based upon its extension (see apicFindExecutable in basWindows API module).
I'm able to use code to create a shell call and debug print it to the immediate window. If I put my cursor in the immediate window at the end of the shell call and hit [enter] the external file will open as desired. If I try to open the external file directly through code, I get a file not found error.
To recreate the error take the following steps:
(1) browse to files that are accessible from your computer (2) click the PREPARE DATA AND OPEN MAIL MERGE DOCUMENTS command button
Shell function call is made by the fnOpenFile function located in the basOpenFile module. There has to be a trick here that I'm missing.
I'm trying to delete a file in a network location. Sometimes the file is there, sometimes it's not, so I'm using the following code:
Code: strPath = "etwork driveMy Folder" strFilename = "MyFile.doc" If Not Dir(strPath & strFilename) = "" Then Kill strPath & strFilename
Occasionally, I get a runtime 52 error when the file doesn't exist. I don't understand why I'm getting this when, if the file doesn't exist, the Dir function should return "".I searched the forums for Runtime 52, and didn't find anything pertaining to this.
I have created a db in which the front end has been distributed around the office and opened in runtime. The basic function of the db is to track current projects and contact between ourselves and clients.
When we have update meetings we use the large screen TV to view the db but it only takes up one small corner of the screen and is near on impossible to read.
I would like to know if there is any way that the picture can be stretched to fit the screen that it is being displayed on? Or would I have to create a separate version for the large screen so that people can read?
I have an Access database that sends an email to users when there is an exception in the query. It works fine when I run it from Windows 7, but when I use task scheduler I get an error message;
I have an Access 2000 application which, on startup, always launches a 'switchboard' form and sometimes gets information from the user during the startup. Both forms are opened with VBA using DoCmd.OpenForm; the switchboard opens as acNormal and the input form (when used) as acDialog.
Under normal circumstances this works fine.
If, however, the Access window ceases to be the active window in Windows (e.g. the user selects another application's window in the taskbar) the forms do not open (all other VBA code runs correctly).
My problem concerns importing a date from a txt file. I've been doing this for years with '97 and 2003 with no problem, but with 2007 I am now getting import errors which I can't resolve. The files, either fixed width or delimited, contain date information in the format ddmmyyyy (without any date separators). After importing I receive an import error message, and the relevant field in the table is blank.
In Access '97 or 2003 I can import date information directly into an Access date/time field by using an import specification where I have set the date delimiter to blank (by default this is set to "/" , so I simply delete this to leave the box empty). Using this method a file containing "25122007" (without the inverted commas) will be imported into Access as a date, and can be subsequently manipulated as date without having to resort to any fancy reformatting tricks. Obviously the import will not be sucessful if the date delimiter in the import spec is left as "/", or set to anything else, eg "." or ":".
But now that I've updated to Access 2007 this is just not possible no matter what I do or try. I can only import a date if the txt data has a separator, and that the same separator is set in the import specification.
In some new databases I have done a couple of workarounds, importing it as text into a text field, then using a CDate(Format(CLng([date]),"00/00/0000")) type expression in a subsequent query, but this is a pain having to do it, a really backward step.
But the real pain is older databases ('97 or 2003) which have been converted up to '07; they no longer work, and there is a lot of redesign to be done unless somone can tell me what I'm doing wrong.
Unfortunately I am not able to change the format of the dates in the data I receive, so the solution has to come from my end (ie Access). Surely Access 2007 should be able to recognise 25122007 as a date? All ideas gratefully received.
I've been happily using various versions of Access since 1994 and I've learnt lots along the way, and have always previously been able to sort out problems that I've come across without resorting to a forum, but I'm now really puzzled by a problem that I have come across in Access 2007. So although this is my first post I certainly wouldn't call myself a newbie. Hopefully I have described the problem accurately (it is realy simple in fact), but very happy to provide more information if required.
On trying to import an Excel 2007 file into Access 2007 I get the following:
1) Choose "External Data," Import, Exce 2) Select small file in MS Excel 2007 format. 3) Click on Import the source data into a new table ... 4) Choose OK
Immediately get "Microsoft Office Access has stopped working. Windows is checking for a solution to the problem..." This message never resolves, so I have to click 'Cancel'.
Then I get "Microsoft Office Access is trying to recover your information..." I have to click "Cancel" here as well and then kill MS Access in Task Manager.
Event Viewer gives following message, which is of no help: "ID: 2, Application Name: Microsoft Office Access, Application Version: 12.0.6211.1000, Microsoft Office Version: 12.0.6215.1000. This session lasted 710 seconds with 120 seconds of active time. This session ended with a crash."
Trying to import a small Excel 2003 file leads the same result. The same happens with a CSV file.
I have uninstalled and reinstalled Office 2007 as well. I am using Vista Ultimate.