Opening databases without using Forms and placing the data control objects on them 
Author Message
 Opening databases without using Forms and placing the data control objects on them

Rookie Question:

I am writing a "DLL" of sorts that will read a text file and place the data
into appropriate databases / fields.  There is no interaction with the
operator.  The problem I am haiving is finding documentation on opening the
database, writing to it, then saving the record(s).

For example, I am using Access for the database.  Inside Access I have
defined Tables.  I want to open the tables and populate them with data
without using a form to set the datacontrols with.

All of the documentation I have seen is regarding user interaction from the
console, ie. buttons to move to the next record/previous record, etc.

In the old days of  "Basic", we could simply open a data file, move data to
the specific fields, and then save the data.

Anything in doc's that represents this would be greatly appreciated!!!

Thanks for you help in advance.

Mike Bourne



Fri, 15 Aug 2003 08:12:05 GMT  
 Opening databases without using Forms and placing the data control objects on them
Take a look at ADO (I assume you are using VB).

Rene


Quote:
> Rookie Question:

> I am writing a "DLL" of sorts that will read a text file and place the
data
> into appropriate databases / fields.  There is no interaction with the
> operator.  The problem I am haiving is finding documentation on opening
the
> database, writing to it, then saving the record(s).

> For example, I am using Access for the database.  Inside Access I have
> defined Tables.  I want to open the tables and populate them with data
> without using a form to set the datacontrols with.

> All of the documentation I have seen is regarding user interaction from
the
> console, ie. buttons to move to the next record/previous record, etc.

> In the old days of  "Basic", we could simply open a data file, move data
to
> the specific fields, and then save the data.

> Anything in doc's that represents this would be greatly appreciated!!!

> Thanks for you help in advance.

> Mike Bourne



Fri, 15 Aug 2003 17:46:26 GMT  
 Opening databases without using Forms and placing the data control objects on them
For your code to work, I think you just have to insert a Refresh before the
addNew (that is after having initialised the control)
d
ata1.refresh

Know, you could also do it without a datacontrol:

Add the MS ActiveX Data Object in the References,

    Dim cnn     As New ADODB.Connection
    Dim rst     As New ADODB.Recordset
    Dim fld     As ADODB.Field

    ' Open the connection
    cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=e:\databases\Address.mdb;"

    ' Open the static recordset
    rst.Open "select * from AddressInfo", cnn, adOpenKeyset,adLockOptimistic

    rst.addNew
    rst!streetNumber = ...
    rst("streetnumber") =...
...

    ' Save the changes you made to the current record in the Recordset

    rst.update

   'Close the recordset
    rst.Close

Daniel Perret

Quote:
> Ok, I did some reading and this is what I came up with:

> data1.ConnectionString = "provider=microsoft.jet.oledb.4.0;
> datasource=e:\databases\Address.mdb
> data1.CommandType = adCmdTable
> data1.RecordSource = "AddressInfo

> data1.Recordset.AddNew
> data1("streetnumber") = (Mid(sSegmentString, 3, 10))
> data1.Recordset.Save

> The problem is that I am getting the following error:

> This error occurs (via debug) when it tries to execute the line
> "data1.recordset.addnew".

> What am I doing wrong?

> All I want to do is open an Access Database (table) and add new records.
> Could some one outline using the minimual amount as possible as to what the
> 5 or 6 lines of could would look like.  The manual that I am reading iw
> quite confusing.  If someone could just give the bare minimum for adding
> data to one field, I can do the rest.

> Thanks in advance.

> Mike Bourne.



> > Take a look at ADO (I assume you are using VB).

> > Rene



> > > Rookie Question:

> > > I am writing a "DLL" of sorts that will read a text file and place the
> > data
> > > into appropriate databases / fields.  There is no interaction with the
> > > operator.  The problem I am haiving is finding documentation on opening
> > the
> > > database, writing to it, then saving the record(s).

> > > For example, I am using Access for the database.  Inside Access I have
> > > defined Tables.  I want to open the tables and populate them with data
> > > without using a form to set the datacontrols with.

> > > All of the documentation I have seen is regarding user interaction from
> > the
> > > console, ie. buttons to move to the next record/previous record, etc.

> > > In the old days of  "Basic", we could simply open a data file, move data
> > to
> > > the specific fields, and then save the data.

> > > Anything in doc's that represents this would be greatly appreciated!!!

> > > Thanks for you help in advance.

> > > Mike Bourne

>  [Image]



Sat, 16 Aug 2003 16:54:45 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Opening databases without using Forms and placing the data control objects on them

2. Opening a database without using a DATA Control ?

3. Opening a database without using a DATA Control ?

4. Objects: Using them without placing them on a form

5. How can i print Everything on my form without using th printform method

6. open database without data control

7. Using VB5 to import data to access without using the Data control

8. using ordinairy access to database without data control

9. Connecting to a database without using the data control

10. using Data Control without a form

11. Creating an instance of a control without placing it on a form

12. Using the data control to open a Access Database with password

 

 
Powered by phpBB® Forum Software