Error 2950 (1 Viewer)

GregMiller

Registered User.
Local time
Today, 07:32
Joined
Dec 5, 2019
Messages
18
I have a database from which I need to send a form by e-mail to selected recipients. I use a combobox to allow the user to select each recipient in turn and then click a button to produce the email and its attachment. This worked perfectly in one database (Messenger email test.accdb) but when I tried to use the same method in another database (GA by Email.accdb) I get an error 2950. I have made the location of the second database a trusted location but I still get the error 2950. I assume there must be some small difference in the second database that is causing the problem but I can’t see what it is. Can somebody with a sharper eye or more experience tell me where the problem is?
 

Attachments

  • GA by Email.accdb
    820 KB · Views: 449
  • Messenger email test.accdb
    1.1 MB · Views: 481

Gasman

Enthusiastic Amateur
Local time
Today, 15:32
Joined
Sep 21, 2011
Messages
14,235
You really need to learn VBA. :(
Trying to debug a macro is a nightmare. 🤬

Eventually I tracked it down to this I believe
Code:
=DLookUp("GACurYrwTotEmail!Email","GACurYrwTotEmail]","GACurYrwTotEmail![Diocese Number]= " & [Combo29])

I'd tidied the combo up, numeric, so no need for quotes, that would cause an error as well. I tried a hardcoded email address and that worked.

Came down to a missing [ for the domain name I believe.?

FWIW to avoid more mistakes like this, you are given the function the domain so,

Code:
=DLookUp("Email","[GACurYrwTotEmail]","[Diocese Number]= " & [Combo29])
is less to type and so less prone to errrors.

Edit: I also got the 2950 message before fixing the DB

HTH
 

GregMiller

Registered User.
Local time
Today, 07:32
Joined
Dec 5, 2019
Messages
18
This is the message I get when I try to run the procedure. It is said that the error often arises when the database is not trusted by Access but that should have been resolved by making the database location a trusted location.
 

Attachments

  • Screenshot_38.png
    Screenshot_38.png
    10.2 KB · Views: 476

GregMiller

Registered User.
Local time
Today, 07:32
Joined
Dec 5, 2019
Messages
18
You really need to learn VBA. :(
Trying to debug a macro is a nightmare. 🤬

Eventually I tracked it down to this I believe
Code:
=DLookUp("GACurYrwTotEmail!Email","GACurYrwTotEmail]","GACurYrwTotEmail![Diocese Number]= " & [Combo29])

I'd tidied the combo up, numeric, so no need for quotes, that would cause an error as well. I tried a hardcoded email address and that worked.

Came down to a missing [ for the domain name I believe.?

FWIW to avoid more mistakes like this, you are given the function the domain so,

Code:
=DLookUp("Email","[GACurYrwTotEmail]","[Diocese Number]= " & [Combo29])
is less to type and so less prone to errrors.

Edit: I also got the 2950 message before fixing the DB

HTH
Thanks for your help Gasman that works perfectly. I did teach myself Visual Basic about 25 years ago but then didn't use it much. What I need to get my head around is the interface between Access and VBA.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 22:32
Joined
May 7, 2009
Messages
19,233
please see if it is fixed.
i used VBA.
 

Attachments

  • GA by Email.accdb
    664 KB · Views: 372

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 09:32
Joined
Feb 28, 2001
Messages
27,142
For the record, error 2950 is "Unable to run action" - most likely a macro, according to the more detailed description. I offer this only so that readers will understand the error, because it seems my colleagues have pointed out the REASON that Access was unable to run the action.
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 15:32
Joined
Sep 12, 2006
Messages
15,640
"GACurYrwTotEmail]"

As @Gasman pointed out, the error was probably the unpaired square bracket in the above term, Obviously not an error that the compile was programmed to check for in particular.
 

GregMiller

Registered User.
Local time
Today, 07:32
Joined
Dec 5, 2019
Messages
18
please see if it is fixed.
i used VBA.
Thanks Arnelgp that works too. It is also useful to have an example of VB code to help me come to grips with the interface between Access and VBA.
 

Users who are viewing this thread

Top Bottom