Results 1 to 2 of 2

Thread: dimming fields?

  1. #1
    Join Date
    Aug 2007
    Posts
    7

    Unanswered: dimming fields?

    I'm running a query but need some help with something. I have two tables called style and sod. In short, I need to create a field(lets call it DM) where:

    If style.itemtype = HG then DM = EA
    If style.itemtype = <>HG then refer to another statement that would say something like:
    if sod.sq1 = >0 then DM = S
    if sod.sq2 = >0 then DM = M
    if sod.sq3 = >0 then DM = L
    if sod.sq4 = >0 then DM = XL
    if sod.sq5 = >0 then DM = XXL

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    This might do the trick.
    Code:
    Dim myValue As String
    
    If style.itemtype = "HG" Then
      myValue = "EA"
    Else
      If sod.sq1 >= 0 Then
        myValue = "S"
      ElseIf sod.sq2 >= 0 Then
        myValue = "M"
      ElseIf...
        ....
      End If
    End If
    
    DoCmd.RunSQL "UPDATE MyTable SET DM = '" & MyValue & "'"
    George
    Home | Blog

Posting Permissions

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