Results 1 to 5 of 5
  1. #1
    rgoth is offline Novice
    Windows 8 Access 2013
    Join Date
    Oct 2014
    Posts
    3

    Angry Outlook and access

    Hi what I am trying to do is connect to Access from Outlook. I have tried several ways this way gets me part way there

    ' Initialize string to database path.
    Const strConPathToSamples = "C:\Users\Doc.DENTAL\Documents\"

    strDB = strConPathToSamples & "My New App.accdb"
    ' Create new instance of Microsoft Access.


    Set appAccess = _
    CreateObject("Access.Application")
    ' Open database in Microsoft Access window.
    appAccess.OpenCurrentDatabase strDB
    appAccess.DoCmd.RunSQL "UPDATE tblTest " _
    & "SET Name = 'John' " _
    & "WHERE ConfirmationCode= 2;"

    I can run an update sql but I would also like to run a query based on information with in the subject

    i.e. if the subject is xyz

    I would like to be able to run a query that would look something like this

    Dim rs As RecordSetSet rs = Currentdb.OpenRecordSet("SELECT *, ID FROM MyAccessTable where ConfirmationCode="SUBJECT LINE" ;")
    Do While Not rs.EOF
    'do some things
    rs.MoveNext
    Loop

  2. #2
    rgoth is offline Novice
    Windows 8 Access 2013
    Join Date
    Oct 2014
    Posts
    3
    Further to above I am executing code using rules which will run based on a set of criteria when a new email arrives.

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Use apostrophes (or double the quotes) for text delimiter:
    Dim rs As RecordSetSet rs = Currentdb.OpenRecordSet("SELECT *, ID FROM MyAccessTable where ConfirmationCode='SUBJECT LINE';")

    You want to extract a code from subject text of email message? This means reading each email message until you find correct one. How will code know which email is the one? What is the key to search on - FROM address, a word/phrase in subject, a word/phrase in body?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #4
    rgoth is offline Novice
    Windows 8 Access 2013
    Join Date
    Oct 2014
    Posts
    3
    I am basically looking at how to run a query based on a subject line from a new email. I am sending people appointment reminders via email. when they click on a link in the email a message is sent back to my account with a confirmation code in the subject line. I have a rule set up in outlook that when a new message comes in from a specific email address with the phrase "Confirm Appointment" in the body it will run code in VBA that I would like to update records in a table. Before doing so I need to verify the confirmation code first by looking it up. I can update a table with the following code

    appAccess.DoCmd.RunSQL "UPDATE tblTest " _
    & "SET apt_status = 2 " _
    & "WHERE ConfirmationCode= 22343;"

    but I can query the database to confirm the confirmation code is legit first.

    If that makes since

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    You already have code that can read the email body for the phrase?

    Post that code.

    Use If Then statement to conditionally run update based on result of the phrase search.

    Then how should code pull the confirmation code from the subject line? Where will it be found within the subject text? Post example.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. access to outlook
    By DiGamer in forum Access
    Replies: 1
    Last Post: 10-04-2014, 10:26 AM
  2. Replies: 11
    Last Post: 05-20-2014, 11:32 AM
  3. Access and Outlook
    By sdc1234 in forum Access
    Replies: 4
    Last Post: 07-01-2013, 08:19 AM
  4. Assigning Outlook task from shared Outlook mailbox
    By Remster in forum Programming
    Replies: 2
    Last Post: 11-16-2011, 04:38 AM
  5. Outlook to Access
    By Aubreylc in forum Import/Export Data
    Replies: 1
    Last Post: 01-25-2010, 09:37 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums