data from combo

goat

Registered User.
Local time
Today, 21:15
Joined
Apr 15, 2003
Messages
10
Hello,

Please can you guys help me.

It probably quite simple but I'm still a novice when it comes to Access VB coding. I am currently using the coding which, on the press of a button sends a mail in Lotus notes. This coding is all working fine but I want the
MailDoc.sendto =
to use the data selected in a combo box which is bound to a table(i.e. jon.Dough@msn.com)

Your help is much appreciated.

Many thanks
Goat
 
Is this what you're looking for?

IMO
 

Attachments

Thanks for the reply,

Can you convert it to MS Access 97 for me please, its coming up as an unrecognised database format.

Many thanks
 
Sorry to be a pain

The database attached has a combo box and a button on the 'data entry' form.

What I require is when the email address is selected in the combo box and the button pressed it sends an email.

The email coding in the mailer1 module works fine however I am stuck on how to make the mailer1 module send a mail to the email address selected in the combo box.

Probably quite simple to people who now what their doing but I'm really stuck.

many thanks
 
Can you send the db

IMO
 
Sorry dude,

It won't let me attach it for some reason so I'll give you the code.

Mailer1 module

Public Function SendNotesMail(subject As String, Attachment As String, BodyText As String, SaveIt As Boolean, RtnRec As String)
Dim y As Integer, z As String
Dim X
Dim recip(50) As Variant
Dim Maildb As Object 'The mail database
Dim UserName As String 'The current users notes name
Dim MailDbName As String 'The current users notes mail database name
Dim MailDoc As Object 'The mail document itself
Dim AttachME As Object 'The attachment richtextfile object
Dim Session As Object 'The notes session
Dim EmbedObj As Object 'The embedded object (Attachment)
Set Session = CreateObject("Notes.NotesSession")
UserName = Session.UserName
MailDbName = Left$(UserName, 1) & Right$(UserName, (Len(UserName) - InStr(1, UserName, " "))) & ".nsf"
Set Maildb = Session.GETDATABASE("", MailDbName)
If Maildb.ISOPEN = True Then
Else
Maildb.OPENMAIL
End If
Set MailDoc = Maildb.CREATEDOCUMENT
MailDoc.Form = "Memo"
MailDoc.sendto = "lee keenan/jpmchase"
MailDoc.CopyTo = recip
MailDoc.subject = subject
MailDoc.body = BodyText
MailDoc.SAVEMESSAGEONSEND = SaveIt

If Attachment > "" Then
Set AttachME = MailDoc.CREATERICHTEXTITEM(Attachment)
Set EmbedObj = AttachME.EMBEDOBJECT(1454, "", Attachment, "Attachment")

MailDoc.CREATERICHTEXTITEM ("Attachment")
End If

MailDoc.PostedDate = Now() 'Gets the mail to appear in the sent items folder
MailDoc.ReturnReceipt = RtnRec 'sets the return receipt on or off (0 or 1) value 0 is off.
MailDoc.SEND 0, primeUser
primeUser = ""
'Clean Up
Set Maildb = Nothing
Set MailDoc = Nothing
Set AttachME = Nothing
Set Session = Nothing
Set EmbedObj = Nothing
End Function


Button1

Private Sub Command79_Click()
On Error GoTo Err_Command79_Click

SendNotesMail "Query", "", "Your query is under investigation", False, "0"

Exit_Command79_Click:
Exit Sub

Err_Command79_Click:
MsgBox Err.Description
Resume Exit_Command79_Click

End Sub

Combo box

Private Sub Combo83_AfterUpdate()

End Sub


At the moment it mails Lee Keenan/jpmchase (internal email) fine because of the MailDoc.sendto = "lee keenan/jpmchase" command in the module.

I need the data selected in the combo box (linked to a table) to determine this.

Cheers mate
 
Try changing this line in the module

MailDoc.sendto = "lee keenan/jpmchase"

To

MailDoc.sendto = "& Me!YOURCOMBONAME"

YOURCOMBONAME needs to be the name of your combo on the form.


IMO
 
Last edited:
Cheers mate !

Looks like it would do the trick but for some reason my combo box is appearing unbound eventhough it is linked to the table.

Because of this its saying that it can find the name in my name and address book.

any ideas ?
 
What's in the Row source?

IMO
 
the row source type is table/query

the row source is the title of the table
 
You'll need to Select the Row Source from the table:

SELECT [yourtablename].[thecolumntoselect] FROM yourtablename;

IMO
 
Last edited:

Users who are viewing this thread

Back
Top Bottom