problem in getting absolute positon of recordset

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bluepiper
    New Member
    • Sep 2007
    • 13

    problem in getting absolute positon of recordset

    Im using VB6. On rowcolchange event of may datagrid, im using the Frame caption to get the selected data. The problem is when I select the data on the grid. Its not showing the absolute position, still the first record.

    This is my code:
    Code:
    Private Sub dgUser_RowColChange(LastRow As Variant, ByVal LastCol As Integer)
        Dim deUser As ADODB.Recordset
    
        AdvantageEnvironment.cmdUsers
        Set deUser = AdvantageEnvironment.rscmdUsers
    
           If deUser.RecordCount > 0 Then
           frdet.Caption = "Record " & deUser.AbsolutePosition & " of " & deUser.RecordCount
                If IsNull(deUser.Fields("username").Value) Then
                    txtUserName.Text = ""
                Else
                    txtUserName.Text = deUser.Fields("username").Value
                End If
                If IsNull(deUser.Fields("userpass").Value) Then
                   txtPassword.Text = ""
                Else
                   txtPassword.Text = deUser.Fields("userpass").Value
                End If
                If IsNull(deUser.Fields("fullname").Value) Then
                   txtFullName.Text = ""
                Else
                   txtFullName.Text = deUser.Fields("fullname").Value
                End If
                If IsNull(deUser.Fields("position").Value) Then
                   txtPosition.Text = ""
                Else
                   txtPosition.Text = deUser.Fields("position").Value
                End If
                If deUser.Fields("urg").Value = "True" Then
                   CheckURG.Value = 1
                Else
                   CheckURG.Value = 0
                End If
                If (deUser.Fields("cashier").Value = "True") Then
                   CheckCASH.Value = 1
                Else
                   CheckCASH.Value = 0
                End If
                If (deUser.Fields("services").Value = "True") Then
                   CheckSERV.Value = 1
                Else
                   CheckSERV.Value = 0
                End IF
    End Sub
    My recordset cursor location is Client-side cursor
    cursor type = static
    loc type = optimistic

    What should i do? Please help me. Thanks.
  • QVeen72
    Recognized Expert Top Contributor
    • Oct 2006
    • 1445

    #2
    Hi,

    Where have u mentioned Cursor location and lock type for deUser...?
    Change the declaration of deUser, give New Keyword:

    [code=vb]
    Dim deUser As New ADODB.Recordset
    [/code]

    What does this line Indicate..?:
    AdvantageEnviro nment.cmdUsers

    Why Use Caption of some Control to save the Position...? Create a FormLevel Variable and Save the Position in that variable..


    Regards
    Veena

    Comment

    Working...