Page 2 of 2 FirstFirst 12
Results 16 to 17 of 17
  1. #16
    Xiaoding is offline Novice
    Windows 2K Access 2003
    Join Date
    Nov 2009
    Posts
    29

    Re:

    TAG_NUMBER is formatted text in the table.



    Yes, I got rid of the = sign.

    Another thing I just noticed: I input some numbers into the first three entry boxes, run the code, get the error...the value of strHold = 0, I think it should read the three numbers, no?

    thnx,

    Xiaoding

  2. #17
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    Yes, you spotted another flaw I had. I had forgotten to concatenate it with itself. See the first red bit. Then we also need the other red bits (& Chr(34)) where we surround the text values with quotes:

    Code:
    Private Sub cmd18_Click()
        On Error GoTo Err_cmd18
     
        Dim strFilter As String
        Dim strHold As String
        Dim intCount As Integer
     
        intCount = 1
     
        Do Until intCount = 19
            If Len(Me.Controls("txt" & intCount).Value & vbNullString) > 0 Then
                strHold = strHold & Chr(34) & Me.Controls("txt" & intCount).Value & Chr(34) & ","
            End If
            intCount = intCount + 1
        Loop
     
        If Left(strHold, 2) = ", " Then
            strHold = Left(strHold, Len(strHold) - 2)
        End If
      strHold = " In(" & strHold & ")"
        strFilter = "[aims_WKO].[TAG_NUMBER] " & strHold & "AND aims_WCT.RESPONSE = '006' AND aims_EQU.EQU_STATUS = 'I' AND aims_WKO.WO_TYPE='pm'"
     
        DoCmd.OpenReport "RPT18", acViewPreview, , strFilter
     
    cmd18_ExitHere:
        Exit Sub
     
    Err_cmd18:
        MsgBox Err.Description
        Resume cmd18_ExitHere
     
    End Sub

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

Similar Threads

  1. Strange report results
    By DDows in forum Reports
    Replies: 5
    Last Post: 01-10-2011, 06:43 PM
  2. Replies: 2
    Last Post: 08-17-2010, 10:54 AM
  3. Replies: 0
    Last Post: 07-06-2010, 08:12 AM
  4. Limiting the results displayed in a report
    By musicalogist in forum Reports
    Replies: 1
    Last Post: 06-10-2010, 04:44 PM
  5. Replies: 3
    Last Post: 05-21-2010, 03:57 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