Results 1 to 7 of 7
  1. #1
    Gina Maylone is offline Always learning
    Windows 7 64bit Access 2013
    Join Date
    Jun 2013
    Location
    Afton, MN
    Posts
    544

    Email a certain report depending on the value of a field

    Good morning all,



    I have a button setup to email a Proposal Report to specific people. Works fine. I now need the ability to email the Proposal Report (without an addendum) OR email the Proposal Report with an addendum. There are additional fields on the report with an addendum. I have tried the on format event of the Proposal Report to make the addendum fields invisible using this if statement:
    Code:
    if Forms![CurrentJobs]![Addendums].Form![AddendumNum] Is Null Then
    Me.AddendumNum.Visible = False
    Me.Label324.Visible = False
    Me.Label325.Visible = False
    Me.AddendumDrawings.Visible = False
    Me.AddendumDrawingsDate.Visible = False
    Me.Label326.Visible = False
    Me.AddendumFloors.Visible = False
    Me.Label327.Visible = False
    End If
    But I keep getting an "object required" error. Any thoughts on how I can run the Proposal Report with or without addendum information depending on the job?

    I thank you in advance.

  2. #2
    NTC is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2009
    Posts
    2,392
    debug by removing the if/then logic - and then 1 by 1 inactivating each line until you determine which control (not visible state) is triggering the "object required" error. Then one must determine why its visibility is required....can't say from here....

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Try using the IsNull() function rather than Is Null.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    Gina Maylone is offline Always learning
    Windows 7 64bit Access 2013
    Join Date
    Jun 2013
    Location
    Afton, MN
    Posts
    544
    Thanks you guys. I got this to work:
    Code:
    If Forms![currentjobs]![Addendums].Form![AddendumNum] < 1 Then
    Me.AddendumNum.Visible = False
    Me.Label324.Visible = False
    Me.Label325.Visible = False
    Me.AddendumDrawings.Visible = False
    Me.AddendumDrawingsDate.Visible = False
    Me.Label326.Visible = False
    Me.AddendumFloors.Visible = False
    Me.Label327.Visible = False
    ElseIf Forms![currentjobs]![Addendums].Form![AddendumNum] > 0 Then
    'If Len(Forms!job!ADDENDUM_NO.Value) > 0 Then
    Me.AddendumNum.Visible = True
    Me.Label324.Visible = True
    Me.Label325.Visible = True
    Me.AddendumDrawings.Visible = True
    Me.AddendumDrawingsDate.Visible = True
    Me.Label326.Visible = True
    Me.AddendumFloors.Visible = True
    Me.Label327.Visible = True
    End If

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Glad you got it sorted. Just for fun:

    Code:
    Dim booAddendum As Boolean
    
    booAddendum = Forms![currentjobs]![Addendums].Form![AddendumNum] < 1 
    
    Me.AddendumNum.Visible = booAddendum 
    Me.Label324.Visible = booAddendum 
    Me.Label325.Visible = booAddendum 
    Me.AddendumDrawings.Visible = booAddendum 
    Me.AddendumDrawingsDate.Visible = booAddendum 
    Me.Label326.Visible = booAddendum 
    Me.AddendumFloors.Visible = booAddendum 
    Me.Label327.Visible = booAddendum
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    Gina Maylone is offline Always learning
    Windows 7 64bit Access 2013
    Join Date
    Jun 2013
    Location
    Afton, MN
    Posts
    544
    Sorry PBaldy,

    I tried. It didn't work.

    Quote Originally Posted by pbaldy View Post
    Glad you got it sorted. Just for fun:

    Code:
    Dim booAddendum As Boolean
    
    booAddendum = Forms![currentjobs]![Addendums].Form![AddendumNum] < 1 
    
    Me.AddendumNum.Visible = booAddendum 
    Me.Label324.Visible = booAddendum 
    Me.Label325.Visible = booAddendum 
    Me.AddendumDrawings.Visible = booAddendum 
    Me.AddendumDrawingsDate.Visible = booAddendum 
    Me.Label326.Visible = booAddendum 
    Me.AddendumFloors.Visible = booAddendum 
    Me.Label327.Visible = booAddendum

  7. #7
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I think I reversed it. Try

    booAddendum = Forms![currentjobs]![Addendums].Form![AddendumNum] > 0
    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. Replies: 1
    Last Post: 11-18-2014, 11:19 AM
  2. Replies: 3
    Last Post: 12-21-2013, 03:57 PM
  3. Replies: 8
    Last Post: 05-13-2013, 06:26 PM
  4. Replies: 1
    Last Post: 02-20-2012, 01:02 PM
  5. Replies: 0
    Last Post: 03-16-2006, 04:59 AM

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