# visual basic database



## Sridhar_Rao (Feb 28, 2007)

I posted this question few days ago in tutorials, nobody replied. so, I am posting this question again in this forum.

I am my own teacher. I download online tutorials and learn on my own. Although I have dozens of them on use ADO controls for Databases, I have not been able to understand it. My knowledge is limited to programming in foxpro2.6. Can anyone help me with the following:
1. Create a database (*.mdb) either through access or programtically in VB6
2. Open the said database table
3. Append the table from on screen controls-repeat for another few records
4. Edit the contents, replace the valuue
5. Save the table & exit

I would wish to inform that I am a complete beginer and learning on my own. If the codes were given line by line, it would be really helpful.


----------



## tuxfan (Mar 3, 2007)

I have made many such softwares but few years ago. I stopped writing softwares and shifted to web. But I think it is really difficult to spoon feed you the steps, especially when physically you are not present with me 

Any idea on how I can help you?


----------



## bugmenot (Mar 4, 2007)

huuuummmmm.....
try downloading some projects from
www.a1vbcode.com
try atleast 100 , then u will get a fair idea..
also practice as much as u can...


----------



## dharmeshhtailor (Mar 4, 2007)

In this article we'll create a simple database in Microsoft Access and then create a user interface in Visual Basic 6.0.

Putting everything together should be relatively easy because we'll use Adodc Componenet to make the connection to our Database.
We'll then add a DataEnvironment and DataReport and within minutes we'll be able to export our DataReport to a Microsoft Word Document. (.doc)

*Creating our Database in Microsoft Access:*

Create a blank database in Microsoft Access and name the database: DataReport. Now create a table by going to: Create Table in Design View and enter the Field Name(s) and Data Type(s) as shown in the image below. Save the table and name it: Customers. 

*img335.imageshack.us/img335/2790/datareport1oo7.jpg

Now, open the Customers Table and fill in the information you see in the image below.

*img335.imageshack.us/img335/5386/datareport2yw1.jpg

 Now let's move on to creating a user interface in Visual Basic 6.0. We're almost there. We"ll just place a few controls and in a short time we'll be able to Export our DataReport to a Microsoft Word. (.doc)

*Creating our User Interface in Visual Basic 6.0*

Open Visual Basic and choose: Standard EXE. Add a Adodc Component by going to Projects, Components and choose Microsoft ADO Data Control. Click Apply and then Close. You will now have a this Component in your ToolBox. Add 9 TextBox(s) named: Text1, Text2, Text3 and so on. Now add 9 Labels named: Label1, Label2, Label3 and so on. Change the Caption Property for each Label as shown in the image below. Add the Adodc Control from our ToolBox named: ADODC1. Add a CommandButton named: Command1. Change the Caption of the CommandButton1 to View Report. Now we just need to make the connection.

If you're wanting to Export a DataReport to Microsoft Word then I would guess that you already know the steps that need to be taken. This expanation will help those who are doing this for the first time or maybe have forgotten a step or two.

Right click ADODC1 control that we'd placed on Form1 and right click ADODC Properties. Choose: Use Connection String and left click Build. When prompted Choose Microsoft Jet 4.0 OLE DB Provider and click Next. Now, click the button to the right where you see 1. Select or enter a database name. Go to the location where you'd saved your database and double click. Check or Test your connection. If everything is on track you'll see a messagebox with the message "Test Connection Succeeded"-- Press OK to close the message and then press OK again.
Now, go to where you see RecordSource and left click. For the CommandType choose 2 - adCmdTable. Now go to Table or Stored Procedure Name and choose Customers (or whatever you'd named your Table) Now just click Apply and then click OK.

Now we'll set the DataSorce and DataField Properties to each Textbox that we'd place onto our Form1 earlier.

Click Text1 and then go to the Properties Window. Set the DataSource Property to ADODC1 and the DataField Property to CustID. (Note: All of the remaining TextBox(s) DataSource Properties will be set to ADODC1) Now go to Text2 and Set the DataSource Property. Set the DataField Property to LastName. Go to Text3 and Set the DataSource Property. Set the DataField Property to FirstName. Set the DataSource and DataField Properties for the remaining TextBox(s). 

*img335.imageshack.us/img335/3407/datareport3nx4.jpg


----------



## bugmenot (Mar 4, 2007)

using codeing is more easier than these ADODC's 
also u get more flexibility..


----------

