Results 1 to 4 of 4
  1. #1
    pjtessi9 is offline Novice
    Windows 10 Office 365
    Join Date
    May 2019
    Posts
    9

    Question Displaying different value than 0 or -1

    In my table I have a field that is a Yes/No value.


    Im my form, I have the option to check the box if the condition applies.
    If the client is RECOMMENDED, I check the box (this gives a value of -1 and if not checked gives a value of 0).

    The problem is that when I create a button in that form to send an automated email and that I program the field RECOMMENDED in vba coding,
    The value that gets written in the email is a -1.
    How can I changed this to display RECOMMENDED instead of the -1 value.

    What is the vba code required to display a different value then the one showed in that field (-1 or 0 in that case)

    Thanks

    Pjay

  2. #2
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,112
    You haven't shown your code, but something like

    IIf(RECOMMENDED = -1, "RECOMMENDED", "Whatever")
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    pjtessi9 is offline Novice
    Windows 10 Office 365
    Join Date
    May 2019
    Posts
    9
    hERE IS THE VBA CODE

    Private Sub Commande1606_Click()
    Dim Msg As String


    Msg = "Hello" & ",<P>" & _
    "After analysis " & DOSSIER_RAI & ".<P>" & _
    "The candidate " & NOM & ",<P>" & _
    "is " & RECOMMANDED & ",<P>" & _
    "This is an automated message."
    'Remember to add REFERENCE TO MICROSOFT OUTLOOK OBJECT LIBRARY


    Dim O As Outlook.Application
    Dim M As Outlook.MailItem

    Set O = New Outlook.Application
    Set M = O.CreateItem(olMailItem)

    With M
    .BodyFormat = olFormatHTML
    .HTMLBody = Msg
    '.Body = Txt - if you use olFormPlain
    .To = Email
    '.CC = emailadress
    .Subject = "Automated message " & DOSSIER_RAI
    .Display
    '.Send "pour l'envoyer sans le preview."

    End With

    Set M = Nothing
    Set O = Nothing
    End Sub

  4. #4
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,112
    So did you try replacing the field reference with the formula I showed?

    Note you spelled it differently in your code that in your description.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Help with displaying last value
    By philozelda in forum Queries
    Replies: 4
    Last Post: 04-18-2020, 04:13 PM
  2. Displaying 0's
    By O.92 in forum Queries
    Replies: 1
    Last Post: 12-14-2015, 04:16 PM
  3. Displaying name
    By Kivan in forum Programming
    Replies: 2
    Last Post: 08-27-2012, 07:48 AM
  4. Not Displaying a : or ,
    By hawkins in forum Forms
    Replies: 9
    Last Post: 08-12-2011, 11:39 AM
  5. Displaying Value and not ID
    By jonny in forum Access
    Replies: 3
    Last Post: 10-19-2009, 08:21 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