473,399 Members | 3,038 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

connecting visual basic with ms access database

Hi !

I want to know the connection code for connecting visual basic and microsoft access. plese give the detail code for this connection. Actually I tried one code which is as follows:

Dim cn as connection
Dim rs as recordset

Private Sub form()
set cn = new connection
set rs = new recordset

cn.open ="Provider Microsoft Access OLEDB jet4.0, database.mdb"
rs.open"([source],cn,adlockoptimistic,adcmdtext)"

End Sub

I am getting error for the above code as "expected =" after 'rs.open'.

Can u please provide me with the correct code as soon possible?

Waiting for reply

Thanks
Jayanti
Mar 12 '08 #1
2 1587
jamesd0142
469 256MB
What version of vb are you using?
Mar 12 '08 #2
pureenhanoi
175 100+
Hi !

I want to know the connection code for connecting visual basic and microsoft access. plese give the detail code for this connection. Actually I tried one code which is as follows:

Dim cn as connection
Dim rs as recordset

Private Sub form()
set cn = new connection
set rs = new recordset

cn.open ="Provider Microsoft Access OLEDB jet4.0, database.mdb"
rs.open"([source],cn,adlockoptimistic,adcmdtext)"

End Sub

I am getting error for the above code as "expected =" after 'rs.open'.

Can u please provide me with the correct code as soon possible?

Waiting for reply

Thanks
Jayanti
the statement Rs.Open is invalid gramma
it must be: rs.Open "[Source]", cn, adOpenStatic, adLockOptimistic, adCmdText

and the connection String of cn is invalid too. I'm not sure can it work without correcting, but you must use this:
Cn.Open "Provider=Microsoft.Jet.Oledb.4.0; Data Source=C:\database.mdb;"
Mar 13 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Krish | last post by:
Hi Friends, Does anyone know how to connect access database into Visual C++ in Visual Studio 6.0. I know the procedure to connect access database into Visual Studio .Net. But Visual Studio 6.0...
1
by: Mohammad-Reza | last post by:
It is now 3 months that we are trying to connect ASP.NET to a SQLServer located on another system However we act,we get a fatal error We need someone to explain the way of connecting to SQLServer...
2
by: jrbrady | last post by:
I am configuring a SQLDataAdapter using the Data Adapter Configuration Wizard. I click New Connection. I select my server name, user name and password, and the database name. I test the...
1
by: ben_chicago | last post by:
I JUST INSTALLED Visual Basic.NET BUT, CANNOT CONNECT TO MY AS/400 (OS400 5.1). WHEN I TRY TO CONNECT I GET A SERVER EXPLORER MSG: "UNABLE TO CONNNECT TO DATABASE. IT IS ONLY POSSIBLE TO...
1
by: Dibs | last post by:
Hi, is there anyway of telling what type of database I'm connecting to? we've upgraded a product to vb.net so its using ADODB and ODBC. The database is going to be either Access, SQLServer or...
11
by: CM Manager via DotNetMonster.com | last post by:
I am very frustrated due to this exception error I am receiving. I've tried searching numerous user support groups, Microsoft Support Net, Google, etc. and haven't found exactly my situation....
4
by: kthiagar | last post by:
Hi I am trying to connect to a password protected access file from VB.NET. I have no problem in connecting to Access, if I remove the password. This is what I am doing: In the server explorer,...
2
by: CAM | last post by:
Hello, I am wondering if someone can give me some pointers. Currently I am using Access 2002 I developed an inventory tracking database, which this database is used in California and in...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.