OK the basics, open MSAccess and type a file name (what to save as) then create the database so Column 1 = First Name 2 = Second Name 3 = Address 4 = Town 5 = Postcode 6 = Telephone Number etc
Then create a form in MS access but clicking form and then using the wizard.
In VB create the ADO control ( ctrl+t then scroll down to Microsoft ADO...) rename it to adoAddress, Create 6 labels and 6 textboxes named corressponding to the numbers above. In the properties of the ADO control go to Connection String ---> Ensure that use connection string is checked the click build ---> then select Microsoft Jet 4.0 OLE db provider then next..Click ... and find the database as discussed earlier. When found Test Connection if approved click OK is not try to use a different Provider.Then scroll down to RecordSource in the properties select 2 - adCmdTable in Command Type and then whatever you named your table in MSAccess. Then for each text box name the corresponding to what you want in them e.g Name etc then in each individual textbox the datasource is Address and the datafield is the field you want to see in that textbox from the database.
Then you need code insert and Command Button and Call it cmdAdd and for its Caption write &Add (The & underlines the A), the the same for a save buttonexcept call it cmdSave and Caption = &Save and a delete one finally an Exit Button.
Private Sub cmdAdd_Click()
Private Sub cmdExit_Click()
Private Sub cmdSave_Click()
adoAddress.RecordSet.Fields("INSERT NAME OF FIELD 1 IN DB")
adoAddress.RecordSet.Fields("INSERT NAME OF FIELD 2 IN DB")
Private Sub cmdDelete_Click()
Confirm = MsgBox("Are you sure you want to delete this record?", vbYesNo, "Deletion Confirmation")
If Confirm = vbYes Then
MsgBox "Record Deleted!", , "Message"
MsgBox "Record Not Deleted!", , "Message"
That should be all any question leave a msg I hope this is what you need and find it useful
Many thanks Jwman,
Are you saying the only way I can use Visual Basic is with MS Access as the database back end? I would like to create a Visual basic program purely in VB, is this not possible? do I have to use Access?
I know that you can create databases through the Vis Data Manager on the Addins toolbar within Vb to produce an access dbase and others aswell and it works fine. I have access on my system but if I did not would the Vis Data Manager still create the databese in access???, suppose I could uninstall access to find out !?.
Well i've never used it before I'm quite new my self and really keep to basics. I'm quite excited now you mention it I want to use the Data Manager for another project but i must keep to my encoding program meanwhile. Its proving to be difficult with a trial period as well.
Reference the ADOX library. It's fairly straightforward, (but a bit tedious) to code your own Access database using VB.
There are some good examples over at dBForums sister site, XTreme VB Talk, in the database forum FAQ.
"Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
"I have my standards. They may be low, but I have them!" - Bette Middler
"It's a book about a Spanish guy named Manual. You should read it." - Dilbert