Results 1 to 6 of 6
  1. #1
    Join Date
    Nov 2002
    Location
    Norway
    Posts
    239

    Question Unanswered: Find Record Number

    How can I determine the RecordNumber of a record found with Dlookup function ?

    Thanks.

  2. #2
    Join Date
    Aug 2003
    Location
    Argentina
    Posts
    465

    Wink

    With the CurrentRecord

    Sub RegistroActualDelFormulario(formulario As Form)
    Dim lngNúmRegistro As Long

    lngNúmRegistro = formulario.CurrentRecord
    End Sub
    Saludos
    Norberto

  3. #3
    Join Date
    Nov 2002
    Location
    Norway
    Posts
    239
    Thanks, but that was not what I had in mind. I need to go to a specific record in a table and then determine the record number. I found this solution, but I guess there are more "elegant" methods.


    Private Sub Number_Selected_AfterUpdate()
    Set db = DBEngine.Workspaces(0).Databases(0)
    Set AccTable = db.OpenRecordset("tc-EQUIPMENT")
    I = 1
    Do While Not AccTable.EOF
    If AccTable!Number_ID = Int(Me.Number_Selected) Then
    MsgBox Me.Number_Selected & " has Record Number: " & I
    AccTable.Close
    Exit Sub
    End If
    I = I + 1
    AccTable.MoveNext
    Loop
    End Sub

    regards Vestigo

  4. #4
    Join Date
    Aug 2003
    Location
    Argentina
    Posts
    465
    Sorry for the question. but why do you neet now the record number of
    and especific record, my be there is and another solution.
    Saludos
    Norberto

  5. #5
    Join Date
    Nov 2002
    Location
    Norway
    Posts
    239

    Wink

    On a form I use the commands
    DoCmd.GoToRecord , , acPrevious /acNext /acLast / acFirst to navigate.
    The spesific recorde is used in the combobox with the command:
    DoCmd.GoToRecord , , acGoTo, I
    Where I is the record number where a spesific creteria is met!

    Thats why !
    Have a nice day.

    Vestigo, Norway

  6. #6
    Join Date
    Aug 2003
    Location
    Argentina
    Posts
    465
    You cant use the recordsetClone facility for lookup the record in form and them usefull.

    Sub IDProveedor_AfterUpdate()
    Dim rst As Recordset
    Dim cadNombreBúsqueda As String

    Set rst = Me.RecordsetClone
    cadNombreBúsqueda = Str(Me!IdProveedor)
    rst.FindFirst "IdProveedor = " & cadNombreBúsqueda
    If rst.NoMatch Then
    CuadroMsj "Registro no encontrado "
    Else
    Me.Bookmark = rst.Bookmark
    End If
    rst.Close
    Saludos
    Norberto

Posting Permissions

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