Results 1 to 10 of 10

Thread: msflexgrid vertical scroll

  1. #1

    Thread Starter
    Fanatic Member holly's Avatar
    Join Date
    Aug 2002
    Location
    Somewhere on earth
    Posts
    721

    msflexgrid vertical scroll

    Hi

    I have a msflexgrid on a form which I populate with a SP......What
    I want is to conduct a search and highlight the appropriate row.....my problem is that the RS is highlighted but the flexgrid
    does not scroll down and make the selected RS visible...

    Hope you can understand!!



    VB Code:
    1. Private Sub cmdfind_Click()
    2.  
    3.     Dim LngColumns As Long
    4.     Dim LngRows As Long
    5.  
    6.    On Error GoTo cmdfind_Click_Error
    7.  
    8.         For LngColumns = 0 To MSFlexReview.Cols - 1
    9.         For LngRows = 1 To MSFlexReview.Rows - 1
    10.         If InStr(MSFlexReview.TextMatrix(LngRows, LngColumns), txtPalletID) Then
    11.          Call HiglightMSflex(LngRows)
    12.  
    13.  End If
    14.  Next LngRows
    15.  Next LngColumns
    16.    Exit Sub
    17.  
    18. cmdfind_Click_Error:
    19.  Call ModError_log  'All error descriptions written to a error log
    20.     MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure cmdfind_Click of Form frmReview"
    21.  
    22. End Sub

    Thanks for your help

    Has anyone any suggetions on how I could accomplish this?

    Last edited by holly; Nov 6th, 2003 at 11:29 AM.
    ** HOLLY **

  2. #2
    PowerPoster
    Join Date
    Aug 2000
    Location
    IN SILENCE
    Posts
    6,441

    Well

    TopRow Example
    Attached Files Attached Files
    Remaining quiet down here !!!

    BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....

  3. #3

  4. #4

    Thread Starter
    Fanatic Member holly's Avatar
    Join Date
    Aug 2002
    Location
    Somewhere on earth
    Posts
    721
    This is my code
    VB Code:
    1. '**************************************
    2. 'Procedure to search for pallet ID ****
    3. '**************************************
    4. Private Sub cmdfind_Click()
    5.  
    6.     Dim LngColumns As Long
    7.     Dim LngRows As Long
    8.  
    9.    On Error GoTo cmdfind_Click_Error
    10.  
    11.  
    12.         For LngColumns = 0 To MSFlexReview.Cols - 1
    13.         For LngRows = 1 To MSFlexReview.Rows - 1
    14.         If InStr(MSFlexReview.TextMatrix(LngRows, LngColumns), txtPalletID) Then
    15.             Call HiglightMSflex(LngRows)
    16.    
    17.  End If
    18.  Next LngRows
    19.  Next LngColumns
    20.  
    21.     MSFlexReview.TopRow = (txtPalletID)
    22.    Exit Sub
    23.  
    24. cmdfind_Click_Error:
    25.  Call ModError_log  'All error descriptions written to a error log
    26.     MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure cmdfind_Click of Form frmReview"
    27.  
    28. End Sub

    Can anyone see whats wrong with my code.......I recieve an error
    on this line
    VB Code:
    1. MSFlexReview.TopRow = (txtPalletID)

    Thanks
    ** HOLLY **

  5. #5
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974
    I recieve an error
    which error?? there are thousands of different ones


    I'm guessing that it's a type mismatch, so try this:

    MSFlexReview.TopRow = CInt(txtPalletID)

  6. #6

    Thread Starter
    Fanatic Member holly's Avatar
    Join Date
    Aug 2002
    Location
    Somewhere on earth
    Posts
    721
    I receive an 'error 0'.....I know error 0 indicates that it is not
    a severe error but the code does not work.....and the debug
    highlights the below line as being the error.....

    MSFlexReview.TopRow = CInt(txtPalletID)

    Thanks
    ** HOLLY **

  7. #7
    PowerPoster
    Join Date
    Aug 2000
    Location
    IN SILENCE
    Posts
    6,441

    Well

    Try

    VB Code:
    1. Cdbl(txtPalletID)
    Remaining quiet down here !!!

    BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....

  8. #8

    Thread Starter
    Fanatic Member holly's Avatar
    Join Date
    Aug 2002
    Location
    Somewhere on earth
    Posts
    721
    James,

    I have tried that and I still recieve the same error...

    Thanks
    This is the code I have

    VB Code:
    1. Private Sub cmdfind_Click()
    2.  
    3.     Dim LngColumns As Long
    4.     Dim LngRows As Long
    5.  
    6.    On Error GoTo cmdfind_Click_Error
    7.  
    8.  
    9.         For LngColumns = 0 To MSFlexReview.Cols - 1
    10.         For LngRows = 1 To MSFlexReview.Rows - 1
    11.         If InStr(MSFlexReview.TextMatrix(LngRows, LngColumns), txtPalletID) Then
    12.      
    13.             Call HiglightMSflex(LngRows)
    14.    
    15.  End If
    16.  Next LngRows
    17.  Next LngColumns
    18.  
    19.  Me.MSFlexReview.TopRow = CInt(txtPalletID)
    20.    On Error Resume Next
    21.    Exit Sub
    22.  
    23. cmdfind_Click_Error:
    24.  Call ModError_log  'All error descriptions written to a error log
    25.     MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure cmdfind_Click of Form frmReview"
    26.  
    27. End Sub
    28.  
    29. Public Sub HiglightMSflex(ByVal lngrow As Long)
    30.  Dim i As Long
    31.  
    32.    On Error GoTo HiglightMSflex_Error
    33.  
    34. With MSFlexReview
    35.     If .Rows < 1 Then
    36.       Exit Sub
    37.     End If
    38.     .Redraw = False
    39.     .Col = i
    40.     If .Rows = 1 Then
    41.       .Row = lngrow
    42.     Else
    43.       If lngrow = .Rows Then
    44.         .Row = .Rows - 1
    45.       ElseIf lngrow > .Rows - 1 Then
    46.         .Row = .Rows - 1
    47.       Else
    48.         .Row = lngrow
    49.       End If
    50.     End If
    51.     .ColSel = .Cols - 1
    52.     .HighLight = flexHighlightAlways
    53.     .SelectionMode = flexSelectionByRow
    54.     .AllowBigSelection = False
    55.     .Redraw = True
    56.    
    57.   End With
    58.    Exit Sub
    59.  
    60. HiglightMSflex_Error:
    61.  Call ModError_log  'All error descriptions written to a error log
    62.     MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure HiglightMSflex of Form frmReview"
    63.    
    64. End Sub

    Thanks

    ** HOLLY **

  9. #9
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431
    Originally posted by holly
    I receive an 'error 0'.....I know error 0 indicates that it is not
    a severe error but the code does not work.....and the debug
    highlights the below line as being the error.....

    MSFlexReview.TopRow = CInt(txtPalletID)

    Thanks
    Error 0 means that there is no error. That "error" is usually the result of code falling through to the error routine, but since you seem to have an Exit Sub before the error routine I don't understand why it's happening. In any case to show the bottom of the flexgrid do this.

    MSFlexReview.TopRow = MSFlexReview.Rows - 1

  10. #10
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758
    This has nothing to do with the TopRow problem but the Error 0 problem.

    The call to the ModError_log procedure is clearing the Err object. When the code resumes in cmdfind_Click_Error for the msgbox, err.number = 0, err.description = "".

Posting Permissions

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



Click Here to Expand Forum to Full Width