Welcome to SPN

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

Sign Up Now!
  1. Monthly (Recurring) Target: $300 :: Achieved: $95
      Become a Supporter    ::   Make a Contribution   

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]
     
Since you're here... we have a small favor to ask...

More people are visiting & reading SPN than ever but far fewer are paying to sustain it. Advertising revenues across the online media have fallen fast. So you can see why we need to ask for your help. Donating to SPN's is vote for free speech, for diversity of opinions, for the right of the people to stand up to religious bigotry. Without any affiliation to any organization, this constant struggle takes a lot of hard work to sustain as we entirely depend on the contributions of our esteemed writers/readers. We do it because we believe our perspective matters – because it might well be your perspective, too... Fund our efforts and together we can keep the world informed about the real Sikh Sikhi Sikhism. If everyone who writes or reads our content, who likes it, helps us to pay for it, our future would be much more secure. Every Contribution Matters, Contribute Generously!

    Become a Supporter      ::     Make a Contribution     



Share This Page