Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Pulling Value from table in Access(VBA)

Discussion in 'Information Technology' started by eric1025@gmail.com, Nov 3, 2005.

  1. eric1025@gmail.com

    eric1025@gmail.com
    Expand Collapse
    Guest

    I am currently using Redemption to send email. The way it assigns
    values is by using the = "whatever". I want to pull data from my
    options table for some values.

    For example, instead of .Subject = "access..." I want to use .Subject =
    Options.Access1

    My options table and Access1 field will have the value I want to use.

    Below is an portion of the code as it is now:



    Set myOlApp = CreateObject("Outlook.Application")
    Set MyItem = myOlApp.CreateItem(0)
    Set safemail = CreateObject("Redemption.SafeMailItem")
    Set safemail.Item = MyItem
    Set mynamespace = myOlApp.GetNamespace("MAPI")
    'mynamespace.Logon "myProfile", "myPassword", True, True ' Choose a
    Profile
    Set myfolder = mynamespace.GetDefaultFolder(5)
    With safemail
    .Recipients.Add (strSendTo) ' Send To
    .CC = strCC ' Carbon Copy
    .Attachments.Add (strAttachPath) ' Attachment 1
    '.Attachments.Add (strAttachPath2) ' Attachment 2
    .Subject = "Access Form for user: " & ID2
     
  2. Loading...

    Similar Threads Forum Date
    Sikh Values Blogs Oct 21, 2015
    Jainism Jainism and Sikhism: The Value of Being “Footnote” Traditions Interfaith Dialogues Jul 13, 2015
    World Why do we value gold? Breaking News Dec 9, 2013
    Canada Quebec's Charter of Values: If You Have A Personal Story, Please Share It Here! Breaking News Sep 19, 2013
    Canada Thousands March through Montreal to Protest Quebec Charter of Values (& Video) Breaking News Sep 16, 2013

  3. Ron Hinds

    Ron Hinds
    Expand Collapse
    Guest

    <eric1025@gmail.com> wrote in message
    news:1130965407.284112.315580@z14g2000cwz.googlegroups.com...
    > I am currently using Redemption to send email. The way it assigns
    > values is by using the = "whatever". I want to pull data from my
    > options table for some values.
    >
    > For example, instead of .Subject = "access..." I want to use .Subject =
    > Options.Access1
    >
    > My options table and Access1 field will have the value I want to use.
    >
    > Below is an portion of the code as it is now:
    >
    >
    >
    > Set myOlApp = CreateObject("Outlook.Application")
    > Set MyItem = myOlApp.CreateItem(0)
    > Set safemail = CreateObject("Redemption.SafeMailItem")
    > Set safemail.Item = MyItem
    > Set mynamespace = myOlApp.GetNamespace("MAPI")
    > 'mynamespace.Logon "myProfile", "myPassword", True, True ' Choose a
    > Profile
    > Set myfolder = mynamespace.GetDefaultFolder(5)
    > With safemail
    > .Recipients.Add (strSendTo) ' Send To
    > .CC = strCC ' Carbon Copy
    > .Attachments.Add (strAttachPath) ' Attachment 1
    > '.Attachments.Add (strAttachPath2) ' Attachment 2
    > .Subject = "Access Form for user: " & ID2


    If it isn't a form bound to the table "Options" then use a Recordset:

    Set rs = CurrentDb.OpenRecordset("SELECT Access1 FROM Options WHERE [enter
    your crieteria here]")

    If Not rs.EOF Then
    strSubject = rs!Access1
    End If

    rs.Close

    .... rest of your code ...

    ..Subject = strSubject

    If it is a form bound to the table "Options" then it's even easier:

    .... rest of your code ...

    ..Subject = [Access1]
     

Share This Page