Results 1 to 6 of 6
  1. #1
    Join Date
    Apr 2004
    Location
    Colusa, CA
    Posts
    13

    Lightbulb Unanswered: Gotfocus command!

    I have form that uses a search to get info on another part of the form As in

    I click a dropdown in field 1 to get the info for field two.

    field 1 is category and field two is products. So when I select field 1 it will only show products that are within that category. Ok here is the problem. When a select a category and product, and move to another category it makes all of my info go away in the form. It is still there I see it when I click the field but it disappears. Kind of hard to explain here are a coulpe of pictures to show you. The fields are there. I would like them to not disappear. Can someone help me please!
    Attached Files Attached Files

  2. #2
    Join Date
    Mar 2004
    Location
    Nashville, TN
    Posts
    557
    I would use the afterupdate that way it gets the next field after it updates that one.

    Hope that helps,
    JS
    Have you ever thought about thinking on purpose?

    Jarvis Stubblefield
    Patriot Designs
    Web/Database Development and Consulting
    The-Patriot.net by Patriot Designs

  3. #3
    Join Date
    Apr 2004
    Location
    Colusa, CA
    Posts
    13
    Originally posted by JSThePatriot
    I would use the afterupdate that way it gets the next field after it updates that one.

    Hope that helps,
    JS
    How would I use the afterupdate like this, because if I do this then I get a null value in the products field...... Anyhelp would be appreiated!


    Private Sub ProductID_GotFocus_AfterUpdate()
    Me.ProductID.RowSource = "SELECT DISTINCTROW [ProductID], [ProductName],[Discontinued] " _
    & "FROM Products " _
    & "WHERE [CategoryID]=" & Val(Nz(Me.CategoryName, 0)) _
    & " ORDER BY [ProductName];"
    Me.ProductID.Requery
    End Sub

  4. #4
    Join Date
    Mar 2004
    Location
    Nashville, TN
    Posts
    557
    No. You use the AfterUpdate() instead of the GotFocus().

    Here is your code rewritten. (also make sure you reference that you have an [Event Procedure] in the afterupdate field and no long in the gotfocus field of the ProductID properties).


    Code:
    Private Sub ProductID_AfterUpdate()
    Me.ProductID.RowSource = "SELECT DISTINCTROW [ProductID], [ProductName],[Discontinued] " _
    & "FROM Products " _
    & "WHERE [CategoryID]=" & Val(Nz(Me.CategoryName, 0)) _
    & " ORDER BY [ProductName];"
    Me.ProductID.Requery
    End Sub
    Hope that helps,
    JS




    Originally posted by chris86924
    How would I use the afterupdate like this, because if I do this then I get a null value in the products field...... Anyhelp would be appreiated!


    Private Sub ProductID_GotFocus_AfterUpdate()
    Me.ProductID.RowSource = "SELECT DISTINCTROW [ProductID], [ProductName],[Discontinued] " _
    & "FROM Products " _
    & "WHERE [CategoryID]=" & Val(Nz(Me.CategoryName, 0)) _
    & " ORDER BY [ProductName];"
    Me.ProductID.Requery
    End Sub
    Have you ever thought about thinking on purpose?

    Jarvis Stubblefield
    Patriot Designs
    Web/Database Development and Consulting
    The-Patriot.net by Patriot Designs

  5. #5
    Join Date
    Apr 2004
    Location
    Colusa, CA
    Posts
    13
    Anyother ideas, it is still doing the same thing. The afterupdate did not help it. It is still doing what it did....!


    Originally posted by JSThePatriot
    No. You use the AfterUpdate() instead of the GotFocus().

    Here is your code rewritten. (also make sure you reference that you have an [Event Procedure] in the afterupdate field and no long in the gotfocus field of the ProductID properties).


    Code:
    Private Sub ProductID_AfterUpdate()
    Me.ProductID.RowSource = "SELECT DISTINCTROW [ProductID], [ProductName],[Discontinued] " _
    & "FROM Products " _
    & "WHERE [CategoryID]=" & Val(Nz(Me.CategoryName, 0)) _
    & " ORDER BY [ProductName];"
    Me.ProductID.Requery
    End Sub
    Hope that helps,
    JS

  6. #6
    Join Date
    Mar 2004
    Location
    Nashville, TN
    Posts
    557
    Hmm sorry that didnt help. I dont have any more suggestions at this time. I will see what else I can think of though.

    JS
    Have you ever thought about thinking on purpose?

    Jarvis Stubblefield
    Patriot Designs
    Web/Database Development and Consulting
    The-Patriot.net by Patriot Designs

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •