9:12 AM

Store Ms-Access Data's in Ms-Excel By Visual Basic 1. Create New Visual basic Project
2.Create a new ms-acess database with name eduplusand create table SMASTER containing datas of (sno:autonumber,sname:text,age:number) and save this database in desktop name eduplus. 3. Create Data Controal in forms and click F4 Function Key 4. from this Properities Select Database : select ur database(eduplus from desktop) and select record source and select SMASTER TABLE 4.Goto the Project menu and click Reference and select Microsoft Excel 11.0(this 11.0 defend upon ur Ms-office iam using msoffice 2003). 4. Create "sales.XLS" In excel and save it to "C:\" . 5.Create Command Button and write the following code in command1_click event. Private Sub Command1_Click() Dim app As Excel.Application Dim wb As Excel.Workbook Dim ws As Excel.Worksheet Set app = CreateObject("Excel.Application") Set wb = app.Workbooks.Open("c:\sales.xls") Set ws = app.Sheets(1) ws.Cells(1, 1) = "SNO" ws.Cells(1, 2) = "SNAME" ws.Cells(1, 3) = "AGE" Row = val(2) While Not Data1.Recordset.EOF ws.Cells(Row, 1) = Data1.Recordset.Fields(0) ws.Cells(Row, 2) = Data1.Recordset.Fields(1) ws.Cells(Row, 3) = Data1.Recordset.Fields(2) Row = Val(Row) + Val(1) Data1.Recordset.MoveNext Wend wb.Save wb.Close app.Quit Set app = Nothing End Sub copy and paste the code between Private Sub Command1_Click() . . . . End Sub Run the Programme......................