Re: Help - Access with VB

From: Michael Keating (michael.keating_at_[S$S$S)
Date: 07/24/04


Date: Sat, 24 Jul 2004 22:03:10 +0100

Hi,

1. No, there are a few different ways to access data in a database, but the
data control is probably the easiest. Other ways involve creating
connection, command and recordset objects (usually), initialising these to
obtain the information you want from the database and then loading the data
into the controls. For databound controls, it's more usual to use the data
control as a data source.

2. It sounds as though you're using a wrong Connection String in that
property of the data control .. for an access database your connection
string should look something like:

Provider=Microsoft.Jet.OLEDB.4.0;Password="";Data
Source=C:\Database.mdb;Persist Security Info=True

though obviously not exactly the same. If you click the ellipsis ( ... )
button at the right end of the Command String property in the properties
window, you get the opportunity to "Build" the string .. the build dialog
allows you to test the connection before committing it to the property.

HTH

MFK.

"Vrijesh Jeswant" <jviju21@yahoo.com> wrote in message
news:324101c4713d$67c69db0$a401280a@phx.gbl...
> Hi All,
>
> I am trying to use an Access database from within a Visual
> Basic 6.0 application. I have several forms that are
> supposed to work with various table in the DB. I have a
> few questions regarding this:
>
> 1. Is it absolutely necessary to use a Data Control field
> with each form that accesses the database. Is there a way
> to specify the database without using a data control in
> the VB form?
>
> 2. I am able to include a Data Control and set its
> Database Name to the required DB, but when I try to set
> the RecordSource, I get the "Unrecognized Database Format
> error". I even tried converting the db to both 2000 and
> 2002 formats, but get the same error. Also, is there a way
> to use the tables without having to set the record source?
>
> I have Win2K, Office 2003, VStudio6.0 with Service pack 5
> installed.
>
> I know this question deals more with VB than with Access,
> and I apologize for this, but I am hoping someone has the
> answer. Any help will be very much appreciated.
>
> Thank you and have a great day,
> VJ


Loading