Results 1 to 5 of 5

Thread: DataGrid cannot show all entries from Access!!

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2015
    Posts
    9

    Exclamation DataGrid cannot show all entries from Access!!

    Hello people! First I want to say thanks for all your help on previous threads of mine that has been resolved... Thank you very much, this is a great forum with great people..

    My problem here is that I've got a program working with ADODB and Access (mdb file) with DataGrid... Now when I run the app it doesn't shows all entries from the table! I don't know why! Even when it shows a scrollbar there i can't use it...

    Name:  entrie.jpg
Views: 334
Size:  58.2 KB




    From now, thank you for having read this thread...

    best regards,

  2. #2
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,205

    Re: DataGrid cannot show all entries from Access!!

    You would have to show some code. A picture tells us nothing about what is going on in the code. How many records are you expecting? What query are you using, how are you getting the data into the grid? What other code do you have if any that may be causing a problem with the grid?

  3. #3

    Thread Starter
    New Member
    Join Date
    Jul 2015
    Posts
    9

    Re: DataGrid cannot show all entries from Access!!

    Quote Originally Posted by DataMiser View Post
    You would have to show some code. A picture tells us nothing about what is going on in the code. How many records are you expecting? What query are you using, how are you getting the data into the grid? What other code do you have if any that may be causing a problem with the grid?
    Code:
    Dim conexion As New ADODB.Connection
    Dim registros As New ADODB.Recordset
    
    Private Sub Form_Load()
    
    
    Set DataGrid1.DataSource = registros
    
    If conexion.State <> 1 And registros.State <> 1 Then
    conexion.CursorLocation = adUseClient
    conexion.Open "Provider = Microsoft.Jet.OLEDB.4.0;Data source=" & App.Path & "\dbInventario.mdb"
    
    registros.CursorLocation = adUseClient
    registros.Open "SELECT * FROM Prestaciones ORDER BY IdPrestamo ASC", conexion, adOpenDynamic, adLockOptimistic
    
    Set DataGrid1.DataSource = registros
    
    End If
    End Sub
    
    Private Sub cmdUltimo_Click()
    On Error GoTo error
    registros.MoveLast
    Busqueda.MoveLast
    
    error:
    Label1.Caption = "Ultimo"
    Exit Sub
    End Sub
    
    Private Sub cmdPrimer_Click()
    On Error GoTo error
    registros.MoveFirst
    Busqueda.MoveFirst
    
    error:
    Label1.Caption = "Primero"
    Exit Sub
    End Sub
    
    Private Sub cmdSiguiente_Click()
    On Error GoTo error
    registros.MoveNext
    Busqueda.MoveNext
    error:
    Label1.Caption = "Seleccionado"
    Exit Sub
    End Sub
    
    Private Sub cmdAnterior_Click()
    On Error GoTo error
    registros.MovePrevious
    Busqueda.MovePrevious
    error:
    Label1.Caption = "Seleccionado"
    Exit Sub
    
    
    End Sub
    That's the specific code for the datagrid

  4. #4

    Thread Starter
    New Member
    Join Date
    Jul 2015
    Posts
    9

    Re: DataGrid cannot show all entries from Access!!

    I mean, it actually show all of them, but I can't see them because the SCROLL BAR doesn't moves down....

  5. #5
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: DataGrid cannot show all entries from Access!!

    Almost looks like the datagrid doesn't know how many records are in the grid? Does the grid have a refresh method? If so, try that after you assign the recordset. Just a thought & easy enough to test
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

Tags for this Thread

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