0

Hi i am working on a sotre inventry project.
I just want to fill grid from my ms accsess data base but
i can not understand what i can do
please help me in deeply
it is very urgent

4
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by AndreRet
0

Conver database to access97 and use the data form wizard, which you can find under Add-ins>Add-In Manager. I would suggest that you run the wizard for each type of form and with each type of data access and save this project for future reference.

Good Luck

0

Firstly select MS Datagrid from components. Add the grid to your form and the use the following code -

Private WithEvents cnGrid As ADODB.Connection
Private WithEvents rsGrid As ADODB.Recordset

'In your command button etc. click event add the following

Set rsGrid = New ADODB.Recordset
rsGrid.Open "SELECT * FROM YourTableName ORDER BY YourFieldNameYouWantListedBy", cnGrid, adOpenStatic, adLockOptimistic

If rsGrid.BOF = True Then
    MsgBox "No report to view.", vbOKOnly + vbInformation, "No Report Available"
   
    Exit Sub
ElseIf rsGrid.EOF = True Then
    MsgBox "No report to view.", vbOKOnly + vbInformation, "No Report Available"
       
    Exit Sub
        Else
        
    Set YourDataGridName.DataSource = rsGrid
    
'Set the coloumn width and headings here....    
    rsGrid.Columns(0).Width = 1750
    rsGrid.Columns(1).Width = 3550
    rsGrid.Columns(2).Width = 2150
        
    rsGrid.Columns(0).Caption = "FirstHeadingName"
    rsGrid.Columns(1).Caption = "SeconfHeadingName"
    rsGrid.Columns(2).Caption = "ThirdHeadingName"
    
End If

I hope this solves your problem.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.