Access 2003 macro problem

I've been developing with Access '97 for quite some time. But now that we've 
moved all of our customers to Access 2003 I'm going to do all of the 
development with that tool. I have a macro which worked great in '97. The 
macro was invoked by using the keystroke combination Ctrl-E. In a macro 
named Autokeys, the Macro Name is ^e and the action is the name of a Public 
Sub in a Module. When invoked with Ctrl-E while the cursor was positioned on 
the declaration line of a new Sub or Function (either in a Module or a 
Form's Class Module, etc.) it would create a skeleton declaring certain 
variables and defining the error handler, etc., like so:

Public Function GetCouponCode(Invoice As Long) As String

    On Error GoTo Error_GetCouponCode

    Dim db As Database
    Dim strSQL As String
    Dim rs As Recordset

    Set db = DBEngine(0)(0)

Exit_GetCouponCode:
    Exit Function

Error_GetCouponCode:
    msgbox Error, vbCritical, "Error " & err & " - GetCouponCode"
    Resume Exit_GetCouponCode

End Function

When I try to invoke the macro with Ctrl-E in Access 2003, an Export File 
dialog pops up. Fine, I thought, just a conflict wiht that key combination, 
so I changed the Maro Name to ^+e, which should change the keystroke to 
Ctrl-Shift-E. Nothing happens when I type that keystroke in a module. 
Interestingly, if I am in the main Access 2003 window, that keystroke *does* 
invoke the function defined as the Action for the macro, but with disastrous 
results since I'm not in a Code Window. It seems that now that the Code 
"Window" is actually a separate process, it is ignorant of any macros 
defined in the main access window. So, how do I define a macro that works in 
the Code process? I've tried using the Help system to find out, but, 
frankly, the new Help system SUCKS (that's for another post)! 


0
Ron
6/21/2007 4:43:52 PM
access 16762 articles. 2 followers. Follow

1 Replies
845 Views

Similar Articles

[PageSpeed] 6

On Jun 21, 9:43 am, "Ron Hinds" <b...@microsoft.com> wrote:
> I've been developing withAccess'97 for quite some time. But now that we've
> moved all of our customers toAccess2003 I'm going to do all of the
> development with that tool. I have a macro which worked great in '97. The
> macro was invoked by using the keystroke combination Ctrl-E. In a macro
> named Autokeys, the Macro Name is ^e and the action is the name of a Public
> Sub in a Module. When invoked with Ctrl-E while the cursor was positioned on
> the declaration line of a new Sub or Function (either in a Module or a
> Form's Class Module, etc.) it would create a skeleton declaring certain
> variables and defining the error handler, etc., like so:
>
> Public Function GetCouponCode(Invoice As Long) As String
>
>     On Error GoTo Error_GetCouponCode
>
>     Dim db As Database
>     Dim strSQL As String
>     Dim rs As Recordset
>
>     Set db = DBEngine(0)(0)
>
> Exit_GetCouponCode:
>     Exit Function
>
> Error_GetCouponCode:
>     msgbox Error, vbCritical, "Error " & err & " - GetCouponCode"
>     Resume Exit_GetCouponCode
>
> End Function
>
> When I try to invoke the macro with Ctrl-E inAccess2003, an Export File
> dialog pops up. Fine, I thought, just a conflict wiht that key combination,
> so I changed the Maro Name to ^+e, which should change the keystroke to
> Ctrl-Shift-E. Nothing happens when I type that keystroke in a module.
> Interestingly, if I am in the mainAccess2003 window, that keystroke *does*
> invoke the function defined as the Action for the macro, but with disastrous
> results since I'm not in a Code Window. It seems that now that the Code
> "Window" is actually a separate process, it is ignorant of any macros
> defined in the mainaccesswindow. So, how do I define a macro that works in
> the Code process? I've tried using the Help system to find out, but,
> frankly, the new Help system SUCKS (that's for another post)!

Access 97 included modules and VBA Editor as part of Access. One of
the major changes for Access2000 was that the VBA editor is a separate
program from Access and does not respond to macros in Access.
Best thing I can think of is to have your code "template" easily
available somewhere for copy-pasting to start a new procedure.
Sorry.
Dave

0
david12
6/22/2007 12:28:17 AM
Reply:

Similar Artilces:

Restricting access to note attachments
Hi all, is there a way to restrict access to attachments on notes to specified users. I know we can, using the Security Roles, define who can and can't read/ write the notes fields but we would like our users to be able to view the note, but not open the attachment(s) unless they are the owner of that note (or at least in the business unit, etc.). I know this could be done for Word/ Excel files in Office (Password protection) but are looking for something more encompassing for all attachments inside CRM. Thanks, -- Matt Pring On Oct 21, 3:54=A0pm, Matt Pring <MattPr...@discus...

Outlook Web Access AutoSignature
I would like to know if it's possible to have autosignature in Outlook Web Access, and if so how to implement it. If anyone can help, it would be greatly apreciated. Thank You. It depends on the version of Exchange - Outlook Web Access is a function of Exchange, not Outlook. Exchange 2003 does this natively, previous versions may have a third party add-in that will allow users to do this. For better information, post in an exchange group such as microsoft.public.exchange.admin. --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. Due t...

Problem with latest version of Outlook under XP
This problem is occuring at a friend's local military medical facility: In outlook if you open a new e-mail message and want to task someone, there is a message flag (Red Flag Icon) option. Until recently, when we did this a new task would be generated in the sender's task list. Now all of a sudden it does not work anymore. The task just doesn't show up in any view mode. Any help would be appreciated. ...

Problem with VBA created subform.
Thanks in advance for your help. I have just upgraded an Access 97 DB to 2007. In the DB I have a main form that creates a subform in VBA when a selection is made in a combo box. This form is used by our data entry personal. I have the subform set to automatically jump to the next field when an answer is selected in a combo box (this helps the data entry personal be very fast when entering surveys.) Here is my problem when an answer is selected it stalls for a good 5 seconds then jumps. Since the subform is created in VBA when a selection is made in the main form I can not hard code the jump...

Menu Change back to 2003
Does anybody can tell me how to change the word word 2007 menu back to word 2003 menu?Word 2007 is a nightmare for me! Hi Bo, You can't. However, there are various Add-ins that people have produced to mimick the old toolbars. -- Cheers macropod [Microsoft MVP - Word] "Bo" <Bo@discussions.microsoft.com> wrote in message news:D2269CDD-43F0-4138-BB86-07E685A1AFA8@microsoft.com... > Does anybody can tell me how to change the word word 2007 menu back to word > 2003 menu?Word 2007 is a nightmare for me! As macropod suggests there are add-ins that mim...

Exchange 2003 Email forwarding by Schedule
Hi, I have been looking for some VB code example, without any luck, on forwarding Exchange 2003 email accounts to another email account within exchange using a script. I need to forward and unforward on a schedule. Can anyone direct me to some info that would help me acheive this. Regards Brent Might not be a good solution but: AD Attrib altRecipient is the forward to option. You can easily put a script in place that will modify this value to a single user and then schedule the script to change the forward to as required. Of course AD replication is required after the change and it ...

Having problem Installing Exchange Router
When Installing I keep getting this error: Setup was unable to install the Microsoft CRM-Exchange E-Mail Router. This installation is forbidden by system policy. Contact your system administrator (80070659) I log on as adiminstrator account with local and domain access. I have tried reinstalling Windows installer and Script Host. Please help Make sure the user you are using to install is the same CRM admin user name you used to Install the MS CRM. I hope this works. "Thomas" wrote: > When Installing I keep getting this error: > Setup was unable to install the Mic...

outlook 2003 custom rules and spam filtering
I'm trying to set up rules to move emails from different accounts to different folders. The rules work fine except that spam filtering is not being processed on the accounts that get moved. In other words, I have one "main" account that I have go to the inbox - it has the spam rules apply. The other "secondary" rules go to specific folders - they do not have the spam being processed. Sounds like my custom rule is pre-empting the spam filter rule(s). Is there a way to chain the two together so that spam filtering happens first and then the mover (or vice versa ...

XPath problem with two xmlns
I have got file raport.rld which is an XML file generated by MS Reporting Services. The problem is: in this file are tags from two different namespaces xmlns="http://schemas.microsoft.com/sqlserver/reporting/2003/10/reportdefini tion" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner" when I'm trying to use XPATH to get <teble> tag it doesn't work. (the result is empty) I've removed All tegs like <rd:TypeName>System.Int32</rd:TypeName> Now all is working fine but what to do when I have tags from two different...

easy way to do a simple macro?
Hi I want to make a couple of easy macros, ie delete files from one folder, then paste into folder from another. I know nothing about macros, is there not a simple way of starting macro, then doing the movements you want, while macro records them, similar to excel. thanks tim Correct. Outlook has no macro recorder. It does, however, have an = extensive object model and detailed help files. Plus, there are hundreds = of available code samples on the Internet and tutorials like those at = http://www.outlookcode.com/d/vb.htm#tutorials . I've seen people pick up = the basics in a v...

Access 2003 and Access 2007 Synchronization
I'm setting up a new business relationship with a company in Portugal. They use Access 2003. I have just bought MS Office Professional 2007 (with Access 2007). Our plan is that they will send, once a month or so, their Access db then we will update and add to that db and then return it after another month or so. There probably won't be a lot of updates on our end so the monthly cycle should work. After they synchronize, they will send a new version of the db and we will start over. My goal is to keep everything as simple as possible partially because I don't know how skillf...

Excel Row to Access Columns
Hi, I have a single row in Excel with a lot of data, what I need to do is move that to a column in Access. I need some way to automate that. I know the easiest way to do that would to just transpose it in excel and then import in access.But I cant do that as I just get that excel file with one row and I need some way to automate the process in Access. thanks m -- mk389 ------------------------------------------------------------------------ mk389's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=15272 View this thread: http://www.excelforum.com/showthread.php?...

Hot link in office outlook 2003 inoperatable
When I click a hot link in my Outlook 2003 I don't get any action, what settings do I need to make this happen, I always could perform this in Outlook Express all versions. Hot Links that are in blue letters. John in Ks ka0mow wrote: > When I click a hot link in my Outlook 2003 I don't get any action, what > settings > do I need to make this happen, I always could perform this in Outlook > Express all versions. Hot Links that are in blue letters. John in Ks You mean a "Hyper link, not a "hot" link. Have you installed IE7? -- Registered Linux User no 24...

Outlook Express(6.0) INBOX Problem
I have a problem with M.S Outlook Express where I appear to have ten messages permanantly stuck in my INBOX.No matter how many times I try to access them or do a send/receive they remain "stuck" in there.I think this may have something to do with my McAfee Internet suite(8.0) which I have just had to reinstall.I have tried disabling all elements of Mcafee in case one of these is inhibiting the "release of my O.E INBOX , but still no joy.Do I have to reinstall Outlook EXpress and if so will I lose all my e mails etc.I can in the mean time send and receive E mails as per normal a...

Enable Macros & Disable Insert from code
Hi, 1. How to enable macros from the code? 2. How to disable insert and copy for this workbook? Any help is appreciated. Thanks. Regards, Giri 1. You don't, otherwise what would be the point. -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Giri" <anonymous@discussions.microsoft.com> wrote in message news:762f01c430fd$42f491c0$a601280a@phx.gbl... > Hi, > > 1. How to enable macros from the code? > 2. How to disable insert and copy for this workbook? > > Any help ...

Help displaying a random record in a form--Access newbie
Hello, I am new to Access, so if anyone can help me, please assume I know absolutely nothing! I currently have a table with two columns, ID and CHORE. In each row, the ID number corresponds to a chore that I have entered. I would like to create a form with a button and a text field such that when I press the button, a random chore is displayed in the text field (supposed to make chores more "fun" for my son). There is no need to remove this record from future clicks (the same record can come up over and over without any problem for me) Can anyone explain to me (in pai...

How to remove the Outlook 2003 system tray icon
Hi, Somebody please tell me that there is an option to remove the rather redundant icon Outlook 2003 places in the system tray area! I've been through the options many times but can't seem to find any way of getting rid of it. Thanks muchly Paul You can't get rid of it. You can however hide it. Just right click the Task Bar. Choose Properties. Choose Customize. You can set the Outlook Icon to always hide (in Windows XP only). -- Patricia Cardoza Outlook MVP www.cardozasolutions.com Author, Special Edition Using Microsoft Outlook 2003 ***Please post all replies to the new...

Access
Hi My form takes a few moments to load up as it is fairly substantial SQL statement is there a way to get something to display a graphic or 'loading...' message to appear why it calculate the contents? Steve ...

Outlook 2003 setup
Thanks for the help so far, everyone. Is there a way to get outlook to send/receive email from a free yahoo account? Ta. Check out this site: http://www.ypopsemail.com/ "cameleonkelle" <cameleonkelle@discussions.microsoft.com> wrote in message news:9FA06750-130F-44EA-B114-063B88DC6FC9@microsoft.com... > Thanks for the help so far, everyone. > Is there a way to get outlook to send/receive email from a free yahoo > account? > Ta. ...

access mail on WEB
Is there a way i can check emails from exchanger server 5.5 from an internet browser. I have Exchange 5.5 in win NT 4.0. Thanks! Yes - install OWA (Outlook Web Access) and open up the needed ports in your firewall (80 for http; better to use SSL and port 443 instead). disk0nek wrote: > Is there a way i can check emails from exchanger server > 5.5 from an internet browser. > > I have Exchange 5.5 in win NT 4.0. > > Thanks! ...

Money 2003 password problems
Hi, I run Windows XP and Money 2003. I recently moved all my "c:\documents and settings" to another drive, which involved me having to make registry changes so windows knew where the "My documents" and "Shared Documents" had moved to. Everything worked fine, although I had some problems with MS money after the move so I uninstalled it and reinstalled it again (the exact same version). Since I have reinstalled it, the password I used to use to open my money file is not recognised. I am 100% certain that I am using the correct password. I tried using salv.exe to...

Macro Help
I have this simple function to capture back ground color of a cell. Function BGCol(refRange As Range) BGCol = refRange.Interior.ColorIndex End Function I want to convert this to an array function where that array can store colorindex for all the cells in a specified range and then i can use it in a sumproduct formula to fins cells with a certain color. Any help or direction appreciated. Best, RK Take a look at http://www.xldynamic.com/source/xld.ColourCounter.html, that is exactly what I do there. -- HTH Bob "rk0909" <rk0909@discussions.micros...

access or mount mirrored hard disks
Hi, is it possible to access a mirrored harddrive? or mount the mirrored volume by using api or mfc commands? Thank you in advance Wimpi ...

CRM v4 Accessibility Improvements
Hi all: Does anyone know if any improvements have been med to CRM v4 in the area of accessibility for handicapped users? One of my customers has a user who is blind and they need to make the software accessible to him. Thanks in advance for any and all help. John. Hi John, We have added following Accessibility features in CRM 4.0 : 1) High Contrast Mode (Tools --> Options --> General Tab --> Enable high contrast settings) 2) All the Form input elements have <LABEL FOR> to aid in screen readers. 3) All the Images have a ALT tag (for non text elements) etc. Thanks! Ma...

Access Database In Great Plains
I was wondering if anyone knew how to have the databases that are stored in access transfered over to great plains. I'm current running version 8.0 any help would be greatful. thanks Search Customer Source for integration Manager. MS Access databases can be used as a data source. Vincev "jake" wrote: > I was wondering if anyone knew how to have the databases that are > stored in access transfered over to great plains. I'm current running > version 8.0 any help would be greatful. thanks > > Hi Jake, Is this something you need to do regularly or is it ...