Connecting Tech Pros Worldwide Forums | Help | Site Map

email right click

colinod's Avatar
Familiar Sight
 
Join Date: Nov 2007
Posts: 182
#1: Nov 5 '07
i have to set up a access database with details of mp3s held on company server with the facility to search them, i need to know if it is possible to right click on a found mp3 in the database and send the file it lists by email just like you can with an image on a website thanks

msquared's Avatar
Administrator
 
Join Date: Aug 2006
Location: Dublin, Ireland
Posts: 10,886
#2: Nov 8 '07

re: email right click


Quote:

Originally Posted by colinod

i have to set up a access database with details of mp3s held on company server with the facility to search them, i need to know if it is possible to right click on a found mp3 in the database and send the file it lists by email just like you can with an image on a website thanks

Access does not have an on right click facility.

Your options would be to use the on click, on double click event or a command button. You can then use the send object method to send the information by email.
colinod's Avatar
Familiar Sight
 
Join Date: Nov 2007
Posts: 182
#3: Nov 9 '07

re: email right click


where do you set this up from i amm very new to using access for this
msquared's Avatar
Administrator
 
Join Date: Aug 2006
Location: Dublin, Ireland
Posts: 10,886
#4: Nov 9 '07

re: email right click


Quote:

Originally Posted by colinod

where do you set this up from i amm very new to using access for this

I'm speaking of vba.

If in form design you right click on the textbox containing the data and open properties then look under the event tab you will see a list of the "events".

Choose an event (like On Click) and click on the little arrow to the right. Select [Event Procedure] from the list. Then click the button to the right with the dots. You would add your Send Object code to the blank event procedure that appears.
colinod's Avatar
Familiar Sight
 
Join Date: Nov 2007
Posts: 182
#5: Nov 9 '07

re: email right click


thank mmcarthy i have tried what you said but im afraid i have never used vba before i get as far as the input code point but im not sure what to put or exactly where, this is what i have so far

Option Compare Database

Private Sub Command8_Click()
On Error GoTo Err_Command8_Click


Screen.PreviousControl.SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70

Exit_Command8_Click:
Exit Sub

Err_Command8_Click:
MsgBox Err.Description
Resume Exit_Command8_Click

End Sub

Private Sub filename_Click()

End Sub
msquared's Avatar
Administrator
 
Join Date: Aug 2006
Location: Dublin, Ireland
Posts: 10,886
#6: Nov 9 '07

re: email right click


OK so in Private Sub filename_Click() try something like the following:

Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2. Option Explicit
  3.  
  4. Private Sub Command8_Click()
  5. On Error GoTo Err_Command8_Click
  6.  
  7.  
  8.     Screen.PreviousControl.SetFocus
  9.     DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70
  10.  
  11. Exit_Command8_Click:
  12.     Exit Sub
  13.  
  14. Err_Command8_Click:
  15.     MsgBox Err.Description
  16.     Resume Exit_Command8_Click
  17.  
  18. End Sub
  19.  
  20. Private Sub filename_Click()
  21.  
  22. DoCmd.SendObject ObjectType:=acSendNoObject, _
  23. Subject:="mp3 details", _ 
  24. To:="Tom Jones", _
  25. EditMessage:=True, _ 
  26. MessageText:=Me!filename
  27.  
  28. End Sub
  29.  
colinod's Avatar
Familiar Sight
 
Join Date: Nov 2007
Posts: 182
#7: Nov 9 '07

re: email right click


this is not quite what i was looking for i was hoping for it to be sent using outlook or outlook express so we could enter an email address etc thanks anyway
msquared's Avatar
Administrator
 
Join Date: Aug 2006
Location: Dublin, Ireland
Posts: 10,886
#8: Nov 9 '07

re: email right click


This will open outlook or outlook express. Just change 'Tom Jones' to whatever email address you want. For example ...

Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2. Option Explicit
  3.  
  4. Private Sub Command8_Click()
  5. On Error GoTo Err_Command8_Click
  6.  
  7.  
  8.     Screen.PreviousControl.SetFocus
  9.     DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70
  10.  
  11. Exit_Command8_Click:
  12.     Exit Sub
  13.  
  14. Err_Command8_Click:
  15.     MsgBox Err.Description
  16.     Resume Exit_Command8_Click
  17.  
  18. End Sub
  19.  
  20. Private Sub filename_Click()
  21.  
  22. DoCmd.SendObject ObjectType:=acSendNoObject, _
  23. Subject:="mp3 details", _ 
  24. To:="Tom.Jones@yahoo.com", _
  25. EditMessage:=True, _ 
  26. MessageText:=Me!filename
  27.  
  28. End Sub
  29.  
colinod's Avatar
Familiar Sight
 
Join Date: Nov 2007
Posts: 182
#9: Nov 9 '07

re: email right click


sorry to be pain but i have tried this and am getting the following in an alert box

The expression On Click you entered as the event property settign produced the following error:Ambiguous name detected:Command8_Click
* The expression may not result in the name os a macro, the name of a user defined function, or [event procedure]
*There may have been an error evaluating the function, event, or macro
colinod's Avatar
Familiar Sight
 
Join Date: Nov 2007
Posts: 182
#10: Nov 9 '07

re: email right click


its ok i have sorted it i made the mistake of not replacing the whole script thanks
colinod's Avatar
Familiar Sight
 
Join Date: Nov 2007
Posts: 182
#11: Nov 9 '07

re: email right click


ok i have got it to open the email but i am trying to attach an mp3 file from a folder in our network have you got any ides an this maybe the way it is written in the access database
colinod's Avatar
Familiar Sight
 
Join Date: Nov 2007
Posts: 182
#12: Nov 9 '07

re: email right click


Hi all

The code used also adds the mp3 just as text in the message and not as an attachment????
msquared's Avatar
Administrator
 
Join Date: Aug 2006
Location: Dublin, Ireland
Posts: 10,886
#13: Nov 9 '07

re: email right click


Quote:

Originally Posted by colinod

Hi all

The code used also adds the mp3 just as text in the message and not as an attachment????

Sorry I misread your original question. Attaching something that is not a database object like an mp3 file will require much more complicated code.

To see what I mean have a look at these two other questions for two ways of doing this.

http://www.thescripts.com/forum/thread706529.html
http://www.thescripts.com/forum/thread553562.html

Mary
colinod's Avatar
Familiar Sight
 
Join Date: Nov 2007
Posts: 182
#14: Nov 9 '07

re: email right click


Sorry im afraid i just do not understand the codes its beyond me at the moment????
msquared's Avatar
Administrator
 
Join Date: Aug 2006
Location: Dublin, Ireland
Posts: 10,886
#15: Nov 9 '07

re: email right click


Quote:

Originally Posted by colinod

Sorry im afraid i just do not understand the codes its beyond me at the moment????

In all honesty I think it is. You need to get a good grounding in Access and VBA before attempting something this complicated.
colinod's Avatar
Familiar Sight
 
Join Date: Nov 2007
Posts: 182
#16: Nov 9 '07

re: email right click


ok thanks anyway i will go back to trying to do it with a web form and asp
Reply