Results 1 to 4 of 4
  1. #1
    RunTime91 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Dec 2014
    Posts
    284

    Programming a ComboBox AfterUpdate event with an IIf statement

    Greetings Experts...

    I have googled this to death...review dozens of historical threads here and, well, here I am.

    Couldn't be more simple... If user selects "Lb" in the CmbSoldBy ComboBox then the control TxtQty TextBox = "NA" else it remains empty.



    I've tried brackets [], I've tried using Me.CmbSoldBy and of course Me.TxtQty - I keep getting a 'Compile Error Expected ='

    Code:
    Private Sub CmbSoldBy_AfterUpdate()
    
    
      IIf(CmbSoldBy = "Lb", TxtQty = "NA", TxtQty = "")
    
    
    End Sub
    As Always...

    Thank You Very Much

    RT91

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,574
    Just use a simple If Else Endif construct?

    Or
    Code:
    Me.txtQty =  IIf(CmbSoldBy = "Lb", "NA",  "")
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  3. #3
    RunTime91 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Dec 2014
    Posts
    284
    Oh, Good Lord... I'm jsmh

    Thank You Very Much, Welshgasman!

    Stay warm out there in Wales ~

  4. #4
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,574
    Quote Originally Posted by RunTime91 View Post
    Oh, Good Lord... I'm jsmh

    Thank You Very Much, Welshgasman!

    Stay warm out there in Wales ~
    I am in Mexico right now.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

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

Similar Threads

  1. afterupdate event
    By angie in forum Access
    Replies: 2
    Last Post: 04-05-2018, 06:06 PM
  2. afterupdate event in a form
    By angie in forum Access
    Replies: 2
    Last Post: 04-03-2018, 05:35 PM
  3. Form AfterUpdate Event
    By RayMilhon in forum Forms
    Replies: 2
    Last Post: 09-09-2011, 09:20 AM
  4. AfterUpdate event help
    By 10 Gauge in forum Forms
    Replies: 11
    Last Post: 09-08-2011, 10:04 AM
  5. how to created afterupdate event
    By Brigitt in forum Forms
    Replies: 2
    Last Post: 02-15-2011, 03:23 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