Solved

I need the saving command...

Posted on 2001-06-21
5
148 Views
Last Modified: 2010-05-02
Hi,
  see u all again...this time is the problem that doing the saving...i already done my program ,now I have to save it to the database. which is separate to a lot of fields...so what I need to do and also what is the best way..thanks again a lot of expert there..thans..
0
Comment
Question by:leeboonseong
5 Comments
 
LVL 5

Expert Comment

by:rkot2000
ID: 6215112
what ?????????????????????????. need more info
0
 
LVL 1

Accepted Solution

by:
K7 earned 50 total points
ID: 6215319
Hi
To trite to a DB i would use ADO, for the folowing code to work you have to add Microsoft ActiveX Data Object. you need version 2.6 to ba able to use Access 2000. Also the conection string in the code id for a access 2000 DB located in the same directory as the program.

Dim Con As New ADODB.Connection
Dim RS As New ADODB.Recordset

Con.Mode = adModeReadWrite
Con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\NameOfDB.mdb;Persist Security Info=False"
Con.Open

RS.Open "NameOfTable", Con, adOpenKeyset, , adCmdTable
RS.AddNew
RS("FieldName1") = "Value to save1"
RS("FieldName2") = "Value to save2"
RS("FieldName3") = "Value to save3"
RS.Update

this is probably one of the better ways of saving the data to a DB but there are may more and partly simpler ways

hope this was helpfull

Cat
0
 
LVL 51

Expert Comment

by:Ryan Chong
ID: 6216629
Hi Lee, just comment that Before you do your data entries, besure your database is already normalized, reduce those duplication and redundancy.

Use ADODB.Connection as it's the faster way to save data if compared with ADODC Data Control.
0
 

Author Comment

by:leeboonseong
ID: 6222472
Just want to said thank you for ur help.bye bye. where r u form?
0
 
LVL 1

Expert Comment

by:K7
ID: 6222684
where am i from??
Melbourne Australia
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question