Results 1 to 2 of 2
  1. #1
    bigmac is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2008
    Posts
    21

    Question subform update field

    hi all, on a subform ihave two fields [position] and [approved], in [position] is a lookup, the lookup list is as follows
    6G
    5G
    4G
    3G
    2G


    1G
    after i select one of the above i would like [approved] to load some text depending opon what was selected in[position], example [position] = 6g then [approved] would display "all".
    i have tried the following and placed it in the onupdate property
    if me.position = "6G" then approved = "ALL"
    end if
    but how do i ask it to look at[position] and if its "5G" then place something else in [approved], then if its "4G" put something else in "approved" etc, also is it better to put this code in after update , on dirty,lost focus, or what?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    I use only VBA. In AfterUpdate event property select [Event Procedure]. Double click the ellipses (...). This will put you in the procedure in the VBA editor. Type code, like:

    Select Case Me.position
    Case "4g"
    Me.approved = "something"
    Case "5g"
    Me.approved = "something"
    Case "6G"
    Me.approved = "All"
    End Select

    Or like:

    Me.approved = Switch(Me.position="4g","something", Me.position="5g","somethingelse", Me.position="6g","All")

    Are there only the 6 values? Expand the code to include the other 3.

    Or like:

    Me.approved = Choose(Left(Me.position,1), "something1", "something2", "something3", "something4", "something5", "All")

    If there are a lot more than 6 values, need to do lookup on table.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 7
    Last Post: 07-15-2011, 01:58 PM
  2. Update field in Subform
    By j2curtis64 in forum Forms
    Replies: 5
    Last Post: 04-06-2011, 07:12 PM
  3. Update field in subform from field in Main
    By jpkeller55 in forum Access
    Replies: 9
    Last Post: 10-15-2010, 03:37 PM
  4. Update field in table after update on a subform
    By jpkeller55 in forum Queries
    Replies: 3
    Last Post: 09-30-2010, 08:02 PM
  5. update field from one subform to another
    By bluezidane in forum Programming
    Replies: 3
    Last Post: 08-20-2010, 07:54 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