Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    ngeng4 is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Mar 2010
    Posts
    93

    combo box problem

    i have a combo box and also a text box. the text box will only be appear in a form when the combo box been filled up by certain data. ive used this code. but it didnt work. both whether it is completed or not completed, the text box will appear. how can i solve this problem?

    Private Sub proj_status_AfterUpdate()



    If Me.proj_status = "completed" Then
    Me.proj_year.Visible = True
    MsgBox "Please enter a completed year"
    Me.proj_year.SetFocus
    Else
    Me.proj_year.Visible = True

    End If

    End Sub

  2. #2
    khalid's Avatar
    khalid is offline MS-Access Developer
    Windows XP Access 2007
    Join Date
    Mar 2010
    Location
    Kuwait
    Posts
    244
    Quote Originally Posted by ngeng4 View Post
    i have a combo box and also a text box. the text box will only be appear in a form when the combo box been filled up by certain data. ive used this code. but it didnt work. both whether it is completed or not completed, the text box will appear. how can i solve this problem?

    Private Sub proj_status_AfterUpdate()

    If Me.proj_status = "completed" Then
    Me.proj_year.Visible = True
    MsgBox "Please enter a completed year"
    Me.proj_year.SetFocus
    Else
    Me.proj_year.Visible = True

    End If

    End Sub
    check your code:
    in both condition it is true, so the me.project_year is visible in both case.

    change this:
    Else
    Me.proj_year.Visible = True
    to
    Me.proj_year.Visible = false

    Khalid

  3. #3
    ngeng4 is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Mar 2010
    Posts
    93
    if it is false then, it will appear for both condition

  4. #4
    ManC is offline Novice
    Windows 7 Access 2007
    Join Date
    Mar 2010
    Posts
    22
    have you changed the Visible property of textbox to 'No' on form_Load??..That might be one reason...

  5. #5
    ngeng4 is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Mar 2010
    Posts
    93
    yes..ive change the property

  6. #6
    ManC is offline Novice
    Windows 7 Access 2007
    Join Date
    Mar 2010
    Posts
    22
    but your code works perfectly fine for me!strange!

  7. #7
    ngeng4 is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Mar 2010
    Posts
    93
    yeah..i know. it works fine with my another db.. but for this db, it doesnt work..

  8. #8
    ManC is offline Novice
    Windows 7 Access 2007
    Join Date
    Mar 2010
    Posts
    22
    actually khalid is right...Change Me.proj_year.Visible = false in Else part.Try it...Logically that is what you want. If the combo box text is not "completed", the text box should not be displayed.

  9. #9
    ngeng4 is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Mar 2010
    Posts
    93
    yerp. ive changed that property. but also didnt work

  10. #10
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931

    Combo problem

    My advice is to keep the proj_year visible because you are using the same form to display all records. so making it invisible a user will not be able to see the completed year when you load the form to view all records.I have added some codes to the onOpen Event of your form, Next, Previous and New Buttons. Check out and tell me if your problem is solved. I don't know how much you have changed the Database but I assume you have not changed much.

  11. #11
    ngeng4 is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Mar 2010
    Posts
    93
    the user request for it. they want that thing to be display only if the project completed. then if i xplain more about the thing like u said then they will just say i want that way[only display when the status is completed]

  12. #12
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    You are right the users the ultimate boss... made some more modifications now in the Open Project Update Button, OnOpen Event, Next,Previous, New button. Hope this solves your problem. Check it out.

  13. #13
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    is it working

  14. #14
    khalid's Avatar
    khalid is offline MS-Access Developer
    Windows XP Access 2007
    Join Date
    Mar 2010
    Location
    Kuwait
    Posts
    244
    change your code as below:

    Private Sub proj_status_AfterUpdate()

    If Me.proj_status = "completed" Then
    Me.proj_year.Visible = True
    MsgBox "Please enter a completed year"
    Me.proj_year.SetFocus
    Else
    Me.proj_year.Visible = False

    End If

    End Sub

  15. #15
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    did the modifications work is your problem solved.

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Combo Box problem
    By Rick West in forum Forms
    Replies: 3
    Last Post: 03-18-2010, 04:42 PM
  2. Combo box look-up problem
    By Samdaman in forum Forms
    Replies: 0
    Last Post: 12-14-2009, 02:54 PM
  3. Cascading Combo Box Problem
    By skiptotheend in forum Forms
    Replies: 2
    Last Post: 10-26-2009, 05:31 AM
  4. new problem: Updating Combo box
    By ali-gagi in forum Forms
    Replies: 4
    Last Post: 07-06-2009, 07:29 PM
  5. Problem with combo box
    By osimini in forum Forms
    Replies: 5
    Last Post: 05-25-2009, 03:08 PM

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