Visual Basic
Export MS Access data into MS Excel from Visual Basic
1Following code Export data from MS Access into MS Excel from Visual Basic. You can write this code on any event you want.
Declare following variables on the top.
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim xls As New Excel.Application
Dim wbk As New Excel.Workbook
Dim WithEvents ws As Excel.Worksheet
Dim rng As Excel.Range
then copy the following code as it is. You just need to change the name of command button (e.g. Private Sub your_button_name_Click() )
Private Sub Command1_Click()
cn.Open “provider=microsoft.jet.oledb.4.0;data source=D:\dbfilename.mdb;persist security info=false”
rs.Open “select * from table_name”, cn, adOpenDynamic, adLockOptimistic
To set resolution run time in Visual Basic and Visual Basic.Net
0When we develop an application using small resolution and we have to deploy it on big resolution compare to our development resolution, then it will creates a problem. The following code will help you to resolve this.
You should write this code this code on_load event of form. But before that make sure that you have put your form control on frame at design time.
Form Name = frmdemo