Open database output

K

Kamil

Hello Everybody,
I have an mdb file and I want to use it by creating some reports from it. I
am using crystal reports to do that. My report part is almost ready but I
have a problem in my codes.

When I run the program I want the program to open a blank database and to
add the values I will enter from a form.

But I dont know how to open database for this case.
In the following codes, I can connect my database, I can add my entries but
each time the database is growing. I want to open the database blank in each
run.

Regards...
Akdogan

Set conn = New ADODB.Connection
conn.CursorLocation = adUseClient
conn.Provider = "Microsoft.JET.OLEDB.4.0"
conn.Open "D:\deneme.mdb"
Set rst = New ADODB.Recordset
rst.ActiveConnection = conn
rst.Open "SELECT * FROM kayit1 WHERE aNO = '" & aNO.Text & "' ", conn,
adOpenStatic, adLockOptimistic
 
J

John W. Vinson

Hello Everybody,
I have an mdb file and I want to use it by creating some reports from it. I
am using crystal reports to do that. My report part is almost ready but I
have a problem in my codes.

When I run the program I want the program to open a blank database and to
add the values I will enter from a form.

But I dont know how to open database for this case.
In the following codes, I can connect my database, I can add my entries but
each time the database is growing. I want to open the database blank in each
run.

Regards...
Akdogan

Set conn = New ADODB.Connection
conn.CursorLocation = adUseClient
conn.Provider = "Microsoft.JET.OLEDB.4.0"
conn.Open "D:\deneme.mdb"
Set rst = New ADODB.Recordset
rst.ActiveConnection = conn
rst.Open "SELECT * FROM kayit1 WHERE aNO = '" & aNO.Text & "' ", conn,
adOpenStatic, adLockOptimistic

There is the CreateDatabase method in DAO... but I am perplexed WHY you would
want to routinely create a new "container" mdb file. If you're just trying to
enter data from a form and generate reports, why not simply have a static
database sitting there ready!?

At the worst, you could have a "template" database with the necessary tables
already set up, empty, and copy it into your D:\ drive prior to the Open
statement.

John W. Vinson [MVP]
 
K

Kamil

Thank you for reply,
The program I want to write will be used a few times in day by another users
in network.
Kamil Akdogan
 
J

John W. Vinson

Thank you for reply,
The program I want to write will be used a few times in day by another users
in network.

So? They could open an existing database a few times a day, or even copy a
template a few times a day.

John W. Vinson [MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top