Results 1 to 5 of 5
  1. #1
    a.phoenix is offline Novice
    Windows 10 Access 2013 32bit
    Join Date
    Oct 2017
    Posts
    17

    How to specify the reason when choose combo box to inactive.

    Hello, everyone



    I have the combo box status: active and inactive, and field for reason the problem I have that when user select inactive, they do not give the reason this customer is inactive.


    Can I use macros or Modules to command when select inactive they need to type the reason if not do it they will see the warning message and can't pass this field.


    Think you very much for your help.
    Prakan Pongpanpath

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,943
    Yes, just check the combo and the reason field and issue the required message.
    I would use the Before_Update event of the form, cancel the update and set focus to the reason field.

    You could have also code in a control event, but no guarantee that the user will enter that control.
    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
    a.phoenix is offline Novice
    Windows 10 Access 2013 32bit
    Join Date
    Oct 2017
    Posts
    17
    Thanks for your answer, but in my combo box I have active and inactive. I need the reason only when user select "inactive" and I don't know how to write the modules or set macros

    please tell me more...

    Thank you.

  4. #4
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2013 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    In the BeforeUpdate of the form you need to enter your validation:
    Code:
    If Me.cboYourCombo="Inactive" AND IsNull(Me.txtReason) Then
         Msgbox"You must enter a reason"
         Me.txtReason.SetFocus
         Cancel=True 'stop the update
    End If
    Give it a try and post back if you get stuck!

    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  5. #5
    a.phoenix is offline Novice
    Windows 10 Access 2013 32bit
    Join Date
    Oct 2017
    Posts
    17
    Think you very much for your answer I will try it

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

Similar Threads

  1. Replies: 17
    Last Post: 08-22-2017, 08:43 PM
  2. Combo box to choose fields
    By Ruegen in forum Forms
    Replies: 2
    Last Post: 12-04-2013, 05:46 PM
  3. Replies: 7
    Last Post: 10-03-2013, 03:10 PM
  4. Replies: 3
    Last Post: 07-03-2013, 10:38 AM
  5. Choose Parameter combo box for report
    By RobRay in forum Reports
    Replies: 10
    Last Post: 08-10-2011, 02:48 PM

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